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 = Queue::fake(); | 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; | ||||
} | } | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |