Changeset View
Changeset View
Standalone View
Standalone View
src/tests/TestCaseTrait.php
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | trait TestCaseTrait | ||||
* | * | ||||
* @var ?string | * @var ?string | ||||
*/ | */ | ||||
protected $userPassword; | protected $userPassword; | ||||
/** | /** | ||||
* Assert that the entitlements for the user match the expected list of entitlements. | * Assert that the entitlements for the user match the expected list of entitlements. | ||||
* | * | ||||
* @param \App\User $user The user for which the entitlements need to be pulled. | * @param \App\User|\App\Domain $object The object for which the entitlements need to be pulled. | ||||
* @param array $expected An array of expected \App\SKU titles. | * @param array $expected An array of expected \App\SKU titles. | ||||
*/ | */ | ||||
protected function assertUserEntitlements($user, $expected) | protected function assertEntitlements($object, $expected) | ||||
{ | { | ||||
// Assert the user entitlements | // Assert the user entitlements | ||||
$skus = $user->entitlements()->get() | $skus = $object->entitlements()->get() | ||||
->map(function ($ent) { | ->map(function ($ent) { | ||||
return $ent->sku->title; | return $ent->sku->title; | ||||
}) | }) | ||||
->toArray(); | ->toArray(); | ||||
sort($skus); | sort($skus); | ||||
Assert::assertSame($expected, $skus); | Assert::assertSame($expected, $skus); | ||||
▲ Show 20 Lines • Show All 370 Lines • Show Last 20 Lines |