Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/UserTest.php
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | class UserTest extends TestCase | ||||
* Tests for User::assignSku() | * Tests for User::assignSku() | ||||
*/ | */ | ||||
public function testAssignSku(): void | public function testAssignSku(): void | ||||
{ | { | ||||
$this->markTestIncomplete(); | $this->markTestIncomplete(); | ||||
} | } | ||||
/** | /** | ||||
* Verify a wallet assigned a controller is among the accounts of the assignee. | |||||
*/ | |||||
public function testAccounts(): void | |||||
{ | |||||
$userA = $this->getTestUser('UserAccountA@UserAccount.com'); | |||||
$userB = $this->getTestUser('UserAccountB@UserAccount.com'); | |||||
$this->assertTrue($userA->wallets()->count() == 1); | |||||
$userA->wallets()->each( | |||||
function ($wallet) use ($userB) { | |||||
$wallet->addController($userB); | |||||
} | |||||
); | |||||
$this->assertTrue($userB->accounts()->get()[0]->id === $userA->wallets()->get()[0]->id); | |||||
} | |||||
public function testCanDelete(): void | |||||
{ | |||||
$this->markTestIncomplete(); | |||||
} | |||||
public function testCanRead(): void | |||||
{ | |||||
$this->markTestIncomplete(); | |||||
} | |||||
public function testCanUpdate(): void | |||||
{ | |||||
$this->markTestIncomplete(); | |||||
} | |||||
/** | |||||
* Test user create/creating observer | |||||
*/ | |||||
public function testCreate(): void | |||||
{ | |||||
Queue::fake(); | |||||
$domain = \config('app.domain'); | |||||
$user = User::create([ | |||||
'email' => 'USER-test@' . \strtoupper($domain) | |||||
]); | |||||
$result = User::where('email', 'user-test@' . $domain)->first(); | |||||
$this->assertSame('user-test@' . $domain, $result->email); | |||||
$this->assertSame($user->id, $result->id); | |||||
$this->assertSame(User::STATUS_NEW | User::STATUS_ACTIVE, $result->status); | |||||
} | |||||
/** | |||||
* Verify user creation process | * Verify user creation process | ||||
*/ | */ | ||||
public function testUserCreateJob(): void | public function testCreateJobs(): void | ||||
{ | { | ||||
// Fake the queue, assert that no jobs were pushed... | // Fake the queue, assert that no jobs were pushed... | ||||
Queue::fake(); | Queue::fake(); | ||||
Queue::assertNothingPushed(); | Queue::assertNothingPushed(); | ||||
$user = User::create([ | $user = User::create([ | ||||
'email' => 'user-test@' . \config('app.domain') | 'email' => 'user-test@' . \config('app.domain') | ||||
]); | ]); | ||||
Show All 21 Lines | /* | ||||
return $job_user->id === $user->id | return $job_user->id === $user->id | ||||
&& $job_user->email === $user->email; | && $job_user->email === $user->email; | ||||
}); | }); | ||||
*/ | */ | ||||
} | } | ||||
/** | /** | ||||
* Verify a wallet assigned a controller is among the accounts of the assignee. | |||||
*/ | |||||
public function testListUserAccounts(): void | |||||
{ | |||||
$userA = $this->getTestUser('UserAccountA@UserAccount.com'); | |||||
$userB = $this->getTestUser('UserAccountB@UserAccount.com'); | |||||
$this->assertTrue($userA->wallets()->count() == 1); | |||||
$userA->wallets()->each( | |||||
function ($wallet) use ($userB) { | |||||
$wallet->addController($userB); | |||||
} | |||||
); | |||||
$this->assertTrue($userB->accounts()->get()[0]->id === $userA->wallets()->get()[0]->id); | |||||
} | |||||
public function testAccounts(): void | |||||
{ | |||||
$this->markTestIncomplete(); | |||||
} | |||||
public function testCanDelete(): void | |||||
{ | |||||
$this->markTestIncomplete(); | |||||
} | |||||
public function testCanRead(): void | |||||
{ | |||||
$this->markTestIncomplete(); | |||||
} | |||||
public function testCanUpdate(): void | |||||
{ | |||||
$this->markTestIncomplete(); | |||||
} | |||||
/** | |||||
* Tests for User::domains() | * Tests for User::domains() | ||||
*/ | */ | ||||
public function testDomains(): void | public function testDomains(): void | ||||
{ | { | ||||
$user = $this->getTestUser('john@kolab.org'); | $user = $this->getTestUser('john@kolab.org'); | ||||
$domains = []; | $domains = []; | ||||
foreach ($user->domains() as $domain) { | foreach ($user->domains() as $domain) { | ||||
▲ Show 20 Lines • Show All 387 Lines • Show Last 20 Lines |