Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/PowerDNS/DomainTest.php
- This file was added.
<?php | |||||
namespace Tests\Feature\PowerDNS; | |||||
use App\PowerDNS\Domain; | |||||
use App\PowerDNS\Record; | |||||
use Tests\TestCase; | |||||
class DomainTest extends TestCase | |||||
{ | |||||
/** | |||||
* {@inheritDoc} | |||||
*/ | |||||
public function setUp(): void | |||||
{ | |||||
parent::setUp(); | |||||
$this->domain = Domain::firstOrCreate( | |||||
[ | |||||
machniak: This 'domain' property needs to be declared, otherwise there's a phpstan error. | |||||
'name' => 'test-domain.com' | |||||
] | |||||
); | |||||
} | |||||
/** | |||||
* {@inheritDoc} | |||||
*/ | |||||
public function tearDown(): void | |||||
{ | |||||
$this->domain->delete(); | |||||
parent::tearDown(); | |||||
} | |||||
public function testCreateRecord(): void | |||||
{ | |||||
$before = $this->domain->getSerial(); | |||||
Record::create( | |||||
[ | |||||
'domain_id' => $this->domain->id, | |||||
'name' => $this->domain->{'name'}, | |||||
'type' => "MX", | |||||
'content' => '10 mx01.' . $this->domain->{'name'} . '.' | |||||
] | |||||
); | |||||
Record::create( | |||||
[ | |||||
'domain_id' => $this->domain->id, | |||||
'name' => 'mx01.' . $this->domain->{'name'}, | |||||
'type' => "A", | |||||
'content' => '127.0.0.1' | |||||
] | |||||
); | |||||
$after = $this->domain->getSerial(); | |||||
$this->assertTrue($before < $after); | |||||
} | |||||
Done Inline ActionsIt should have a test for the domain observer - domain creation. machniak: It should have a test for the domain observer - domain creation. | |||||
} |
This 'domain' property needs to be declared, otherwise there's a phpstan error.