Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Jobs/DomainVerifyTest.php
<?php | <?php | ||||
namespace Tests\Feature\Jobs; | namespace Tests\Feature\Jobs; | ||||
use App\Jobs\DomainVerify; | |||||
use App\Domain; | use App\Domain; | ||||
use Illuminate\Support\Facades\Mail; | use Illuminate\Support\Facades\Mail; | ||||
use Tests\TestCase; | use Tests\TestCase; | ||||
class DomainVerifyTest extends TestCase | class DomainVerifyTest extends TestCase | ||||
{ | { | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
Show All 26 Lines | public function testHandle(): void | ||||
[ | [ | ||||
'status' => Domain::STATUS_NEW, | 'status' => Domain::STATUS_NEW, | ||||
'type' => Domain::TYPE_EXTERNAL, | 'type' => Domain::TYPE_EXTERNAL, | ||||
] | ] | ||||
); | ); | ||||
$this->assertFalse($domain->isVerified()); | $this->assertFalse($domain->isVerified()); | ||||
$job = new DomainVerify($domain); | $job = new \App\Jobs\Domain\VerifyJob($domain->id); | ||||
$job->handle(); | $job->handle(); | ||||
$this->assertTrue($domain->fresh()->isVerified()); | $this->assertTrue($domain->fresh()->isVerified()); | ||||
} | } | ||||
/** | /** | ||||
* Test job handle (non-existing domain) | * Test job handle (non-existing domain) | ||||
* | * | ||||
* @group dns | * @group dns | ||||
*/ | */ | ||||
public function testHandleNonExisting(): void | public function testHandleNonExisting(): void | ||||
{ | { | ||||
$domain = $this->getTestDomain( | $domain = $this->getTestDomain( | ||||
'some-non-existing-domain.fff', | 'some-non-existing-domain.fff', | ||||
[ | [ | ||||
'status' => Domain::STATUS_NEW, | 'status' => Domain::STATUS_NEW, | ||||
'type' => Domain::TYPE_EXTERNAL, | 'type' => Domain::TYPE_EXTERNAL, | ||||
] | ] | ||||
); | ); | ||||
$this->assertFalse($domain->isVerified()); | $this->assertFalse($domain->isVerified()); | ||||
$job = new DomainVerify($domain); | $job = new \App\Jobs\Domain\VerifyJob($domain->id); | ||||
$job->handle(); | $job->handle(); | ||||
$this->assertFalse($domain->fresh()->isVerified()); | $this->assertFalse($domain->fresh()->isVerified()); | ||||
} | } | ||||
} | } |