Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/DomainTest.php
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | class DomainTest extends TestCase | ||||
} | } | ||||
/** | /** | ||||
* Test domain creating jobs | * Test domain creating jobs | ||||
*/ | */ | ||||
public function testCreateJobs(): 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 = Queue::fake(); | ||||
Queue::assertNothingPushed(); | $queue->assertNothingPushed(); | ||||
$domain = Domain::create([ | $domain = Domain::create([ | ||||
'namespace' => 'gmail.com', | 'namespace' => 'gmail.com', | ||||
'status' => Domain::STATUS_NEW, | 'status' => Domain::STATUS_NEW, | ||||
'type' => Domain::TYPE_EXTERNAL, | 'type' => Domain::TYPE_EXTERNAL, | ||||
]); | ]); | ||||
Queue::assertPushed(\App\Jobs\DomainCreate::class, 1); | $queue->assertPushed(\App\Jobs\DomainCreate::class, 1); | ||||
Queue::assertPushed( | $queue->assertPushed( | ||||
\App\Jobs\DomainCreate::class, | \App\Jobs\DomainCreate::class, | ||||
function ($job) use ($domain) { | function ($job) use ($domain) { | ||||
$job_domain = TestCase::getObjectProperty($job, 'domain'); | $job_domain = TestCase::getObjectProperty($job, 'domain'); | ||||
return $job_domain->id === $domain->id && | return $job_domain->id === $domain->id && | ||||
$job_domain->namespace === $domain->namespace; | $job_domain->namespace === $domain->namespace; | ||||
} | } | ||||
); | ); | ||||
$job = new \App\Jobs\DomainCreate($domain); | $job = new \App\Jobs\DomainCreate($domain); | ||||
$job->handle(); | $job->handle(); | ||||
} | } | ||||
/** | /** | ||||
* Tests getPublicDomains() method | * Tests getPublicDomains() method | ||||
*/ | */ | ||||
public function testGetPublicDomains(): void | public function testGetPublicDomains(): void | ||||
{ | { | ||||
$public_domains = Domain::getPublicDomains(); | $public_domains = Domain::getPublicDomains(); | ||||
$this->assertNotContains('public-active.com', $public_domains); | $this->assertNotContains('public-active.com', $public_domains); | ||||
Queue::fake(); | $queue = Queue::fake(); | ||||
$domain = Domain::create([ | $domain = Domain::create([ | ||||
'namespace' => 'public-active.com', | 'namespace' => 'public-active.com', | ||||
'status' => Domain::STATUS_NEW, | 'status' => Domain::STATUS_NEW, | ||||
'type' => Domain::TYPE_PUBLIC, | 'type' => Domain::TYPE_PUBLIC, | ||||
]); | ]); | ||||
// Public but non-active domain should not be returned | // Public but non-active domain should not be returned | ||||
Show All 36 Lines | public function testConfirm(): void | ||||
ci-failure-txt A 212.103.80.148 | ci-failure-txt A 212.103.80.148 | ||||
ci-failure-txt MX 10 mx01.kolabnow.com. | ci-failure-txt MX 10 mx01.kolabnow.com. | ||||
kolab-verify.ci-failure-txt TXT "kolab-verify=de5d04ababb52d52e2519a2f16d11422" | kolab-verify.ci-failure-txt TXT "kolab-verify=de5d04ababb52d52e2519a2f16d11422" | ||||
ci-failure-none A 212.103.80.148 | ci-failure-none A 212.103.80.148 | ||||
ci-failure-none MX 10 mx01.kolabnow.com. | ci-failure-none MX 10 mx01.kolabnow.com. | ||||
*/ | */ | ||||
Queue::fake(); | $queue = Queue::fake(); | ||||
$domain_props = ['status' => Domain::STATUS_NEW, 'type' => Domain::TYPE_EXTERNAL]; | $domain_props = ['status' => Domain::STATUS_NEW, 'type' => Domain::TYPE_EXTERNAL]; | ||||
$domain = $this->getTestDomain('ci-failure-none.kolab.org', $domain_props); | $domain = $this->getTestDomain('ci-failure-none.kolab.org', $domain_props); | ||||
$this->assertTrue($domain->confirm() === false); | $this->assertTrue($domain->confirm() === false); | ||||
$this->assertFalse($domain->isConfirmed()); | $this->assertFalse($domain->isConfirmed()); | ||||
Show All 21 Lines |