Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Jobs/DomainCreateTest.php
Show All 38 Lines | public function testHandle(): void | ||||
[ | [ | ||||
'status' => Domain::STATUS_NEW, | 'status' => Domain::STATUS_NEW, | ||||
'type' => Domain::TYPE_EXTERNAL, | 'type' => Domain::TYPE_EXTERNAL, | ||||
] | ] | ||||
); | ); | ||||
$this->assertFalse($domain->isLdapReady()); | $this->assertFalse($domain->isLdapReady()); | ||||
// Fake the queue, assert that no jobs were pushed... | |||||
Queue::fake(); | |||||
Queue::assertNothingPushed(); | |||||
$job = new DomainCreate($domain); | $job = new DomainCreate($domain); | ||||
$job->handle(); | $job->handle(); | ||||
$this->assertTrue($domain->fresh()->isLdapReady()); | $this->assertTrue($domain->fresh()->isLdapReady()); | ||||
Queue::assertPushed(\App\Jobs\DomainVerify::class, 1); | |||||
Queue::assertPushed( | |||||
\App\Jobs\DomainVerify::class, | |||||
function ($job) use ($domain) { | |||||
$job_domain = TestCase::getObjectProperty($job, 'domain'); | |||||
return $job_domain->id === $domain->id && | |||||
$job_domain->namespace === $domain->namespace; | |||||
} | |||||
); | |||||
} | } | ||||
} | } |