Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/DomainTest.php
Show First 20 Lines • Show All 224 Lines • ▼ Show 20 Lines | public function testDelete(): void | ||||
$this->assertTrue(Domain::withTrashed()->where('id', $domain->id)->first()->isDeleted()); | $this->assertTrue(Domain::withTrashed()->where('id', $domain->id)->first()->isDeleted()); | ||||
$domain->forceDelete(); | $domain->forceDelete(); | ||||
$this->assertCount(0, Domain::withTrashed()->where('id', $domain->id)->get()); | $this->assertCount(0, Domain::withTrashed()->where('id', $domain->id)->get()); | ||||
} | } | ||||
/** | /** | ||||
* Test isEmpty() method | |||||
*/ | |||||
public function testIsEmpty(): void | |||||
{ | |||||
Queue::fake(); | |||||
// Empty domain | |||||
$domain = $this->getTestDomain('gmail.com', [ | |||||
'status' => Domain::STATUS_NEW, | |||||
'type' => Domain::TYPE_EXTERNAL, | |||||
]); | |||||
$this->assertTrue($domain->isEmpty()); | |||||
// TODO: Test with adding a group/alias/user, each separately | |||||
// Empty public domain | |||||
$domain = Domain::where('namespace', 'libertymail.net')->first(); | |||||
$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(); | ||||
$domain = $this->getTestDomain('gmail.com', [ | $domain = $this->getTestDomain('gmail.com', [ | ||||
'status' => Domain::STATUS_NEW | Domain::STATUS_SUSPENDED | 'status' => Domain::STATUS_NEW | Domain::STATUS_SUSPENDED | ||||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |