Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/UserTest.php
Show First 20 Lines • Show All 349 Lines • ▼ Show 20 Lines | public function testDomains(): void | ||||
$domain->save(); | $domain->save(); | ||||
$domains = collect($user->domains())->pluck('namespace')->all(); | $domains = collect($user->domains())->pluck('namespace')->all(); | ||||
$this->assertNotContains($domain->namespace, $domains); | $this->assertNotContains($domain->namespace, $domains); | ||||
} | } | ||||
/** | /** | ||||
* Test User::getConfig() and setConfig() methods | |||||
*/ | |||||
public function testConfigTrait(): void | |||||
{ | |||||
$john = $this->getTestUser('john@kolab.org'); | |||||
\App\Policy\Greylist\Setting::where('key', 'greylist_enabled')->delete(); | |||||
$this->assertSame(['greylisting' => true], $john->getConfig()); | |||||
$result = $john->setConfig(['greylisting' => false, 'unknown' => false]); | |||||
$this->assertSame(['greylisting' => false], $john->getConfig()); | |||||
$setting = \App\Policy\Greylist\Setting::where('key', 'greylist_enabled') | |||||
->where('object_id', $john->id) | |||||
->where('object_type', User::class) | |||||
->first(); | |||||
$this->assertSame('false', $setting->value); | |||||
$result = $john->setConfig(['greylisting' => true]); | |||||
$this->assertSame(['greylisting' => true], $john->getConfig()); | |||||
$this->assertSame('true', $setting->fresh()->value); | |||||
} | |||||
/** | |||||
* Test User::hasSku() method | * Test User::hasSku() method | ||||
*/ | */ | ||||
public function testHasSku(): void | public function testHasSku(): void | ||||
{ | { | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$this->assertTrue($john->hasSku('mailbox')); | $this->assertTrue($john->hasSku('mailbox')); | ||||
$this->assertTrue($john->hasSku('storage')); | $this->assertTrue($john->hasSku('storage')); | ||||
▲ Show 20 Lines • Show All 584 Lines • Show Last 20 Lines |