Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/DomainTest.php
Show First 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | class DomainTest extends TestCase | ||||
/** | /** | ||||
* Test isEmpty() method | * Test isEmpty() method | ||||
*/ | */ | ||||
public function testIsEmpty(): void | public function testIsEmpty(): void | ||||
{ | { | ||||
Queue::fake(); | Queue::fake(); | ||||
$this->deleteTestUser('user@gmail.com'); | |||||
$this->deleteTestGroup('group@gmail.com'); | |||||
$this->deleteTestResource('resource@gmail.com'); | |||||
// Empty domain | // Empty domain | ||||
$domain = $this->getTestDomain('gmail.com', [ | $domain = $this->getTestDomain('gmail.com', [ | ||||
'status' => Domain::STATUS_NEW, | 'status' => Domain::STATUS_NEW, | ||||
'type' => Domain::TYPE_EXTERNAL, | 'type' => Domain::TYPE_EXTERNAL, | ||||
]); | ]); | ||||
$this->assertTrue($domain->isEmpty()); | $this->assertTrue($domain->isEmpty()); | ||||
// TODO: Test with adding a group/alias/user, each separately | $this->getTestUser('user@gmail.com'); | ||||
$this->assertFalse($domain->isEmpty()); | |||||
$this->deleteTestUser('user@gmail.com'); | |||||
$this->assertTrue($domain->isEmpty()); | |||||
$this->getTestGroup('group@gmail.com'); | |||||
$this->assertFalse($domain->isEmpty()); | |||||
$this->deleteTestGroup('group@gmail.com'); | |||||
$this->assertTrue($domain->isEmpty()); | |||||
$this->getTestResource('resource@gmail.com'); | |||||
$this->assertFalse($domain->isEmpty()); | |||||
$this->deleteTestResource('resource@gmail.com'); | |||||
// TODO: Test with an existing alias, but not other objects in a domain | |||||
// Empty public domain | // Empty public domain | ||||
$domain = Domain::where('namespace', 'libertymail.net')->first(); | $domain = Domain::where('namespace', 'libertymail.net')->first(); | ||||
$this->assertFalse($domain->isEmpty()); | $this->assertFalse($domain->isEmpty()); | ||||
// Non-empty private domain | |||||
$domain = Domain::where('namespace', 'kolab.org')->first(); | |||||
$this->assertFalse($domain->isEmpty()); | |||||
} | } | ||||
/** | /** | ||||
* Test domain restoring | * Test domain restoring | ||||
*/ | */ | ||||
public function testRestore(): void | public function testRestore(): void | ||||
{ | { | ||||
Queue::fake(); | Queue::fake(); | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |