Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/UserTest.php
Show First 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | */ | ||||
} | } | ||||
/** | /** | ||||
* 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 = []; | $domain = $this->getTestDomain('useraccount.com', [ | ||||
'status' => Domain::STATUS_NEW | Domain::STATUS_ACTIVE, | |||||
'type' => Domain::TYPE_PUBLIC, | |||||
]); | |||||
foreach ($user->domains() as $domain) { | $domains = collect($user->domains())->pluck('namespace')->all(); | ||||
$domains[] = $domain->namespace; | |||||
} | |||||
$this->assertContains(\config('app.domain'), $domains); | $this->assertContains($domain->namespace, $domains); | ||||
$this->assertContains('kolab.org', $domains); | $this->assertContains('kolab.org', $domains); | ||||
// Jack is not the wallet controller, so for him the list should not | // Jack is not the wallet controller, so for him the list should not | ||||
// include John's domains, kolab.org specifically | // include John's domains, kolab.org specifically | ||||
$user = $this->getTestUser('jack@kolab.org'); | $user = $this->getTestUser('jack@kolab.org'); | ||||
$domains = []; | |||||
foreach ($user->domains() as $domain) { | $domains = collect($user->domains())->pluck('namespace')->all(); | ||||
$domains[] = $domain->namespace; | |||||
} | |||||
$this->assertContains(\config('app.domain'), $domains); | $this->assertContains($domain->namespace, $domains); | ||||
$this->assertNotContains('kolab.org', $domains); | $this->assertNotContains('kolab.org', $domains); | ||||
// Public domains of other tenants should not be returned | |||||
$domain->tenant_id = 2; | |||||
$domain->save(); | |||||
$domains = collect($user->domains())->pluck('namespace')->all(); | |||||
$this->assertNotContains($domain->namespace, $domains); | |||||
} | } | ||||
public function testUserQuota(): void | public function testUserQuota(): void | ||||
{ | { | ||||
// TODO: This test does not test much, probably could be removed | // TODO: This test does not test much, probably could be removed | ||||
// or moved to somewhere else, or extended with | // or moved to somewhere else, or extended with | ||||
// other entitlements() related cases. | // other entitlements() related cases. | ||||
▲ Show 20 Lines • Show All 506 Lines • Show Last 20 Lines |