Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/UserTest.php
Show First 20 Lines • Show All 1,146 Lines • ▼ Show 20 Lines | public function testRestore(): void | ||||
\App\Jobs\User\CreateJob::class, | \App\Jobs\User\CreateJob::class, | ||||
function ($job) use ($userA) { | function ($job) use ($userA) { | ||||
return $userA->id === TestCase::getObjectProperty($job, 'userId'); | return $userA->id === TestCase::getObjectProperty($job, 'userId'); | ||||
} | } | ||||
); | ); | ||||
} | } | ||||
/** | /** | ||||
* Test user account restrict() and unrestrict() | |||||
*/ | |||||
public function testRestrictAndUnrestrict(): void | |||||
{ | |||||
Queue::fake(); | |||||
// Test an account with users, domain | |||||
$user = $this->getTestUser('UserAccountA@UserAccount.com'); | |||||
$this->assertFalse($user->isRestricted()); | |||||
$user->restrict(); | |||||
$this->assertTrue($user->fresh()->isRestricted()); | |||||
Queue::assertPushed( | |||||
\App\Jobs\User\UpdateJob::class, | |||||
function ($job) use ($user) { | |||||
return TestCase::getObjectProperty($job, 'userId') == $user->id; | |||||
}); | |||||
Queue::fake(); // reset queue state | |||||
$user->refresh(); | |||||
$user->unrestrict(); | |||||
$this->assertFalse($user->fresh()->isRestricted()); | |||||
Queue::assertPushed( | |||||
\App\Jobs\User\UpdateJob::class, | |||||
function ($job) use ($user) { | |||||
return TestCase::getObjectProperty($job, 'userId') == $user->id; | |||||
}); | |||||
} | |||||
/** | |||||
* Tests for AliasesTrait::setAliases() | * Tests for AliasesTrait::setAliases() | ||||
*/ | */ | ||||
public function testSetAliases(): void | public function testSetAliases(): void | ||||
{ | { | ||||
Queue::fake(); | Queue::fake(); | ||||
Queue::assertNothingPushed(); | Queue::assertNothingPushed(); | ||||
$user = $this->getTestUser('UserAccountA@UserAccount.com'); | $user = $this->getTestUser('UserAccountA@UserAccount.com'); | ||||
▲ Show 20 Lines • Show All 220 Lines • Show Last 20 Lines |