Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120824545
RecordTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
RecordTest.php
View Options
<?php
namespace
Tests\Feature\PowerDNS
;
use
App\PowerDNS\Domain
;
use
App\PowerDNS\Record
;
use
Tests\TestCase
;
class
RecordTest
extends
TestCase
{
/** @var \App\PowerDNS\Domain $domain */
private
$domain
=
null
;
/**
* {@inheritDoc}
*/
public
function
setUp
():
void
{
parent
::
setUp
();
$this
->
domain
=
Domain
::
firstOrCreate
([
'name'
=>
'test-domain.com'
]);
}
/**
* {@inheritDoc}
*/
public
function
tearDown
():
void
{
$this
->
domain
->
delete
();
parent
::
tearDown
();
}
/**
* Test creating DNS records
*/
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'
}
.
'.'
]);
$after
=
$this
->
domain
->
getSerial
();
$this
->
assertTrue
(
$before
<
$after
);
}
/**
* Test updating DNS records
*/
public
function
testUpdateRecord
():
void
{
$record
=
Record
::
create
([
'domain_id'
=>
$this
->
domain
->
id
,
'name'
=>
$this
->
domain
->{
'name'
},
'type'
=>
"MX"
,
'content'
=>
'10 mx01.'
.
$this
->
domain
->{
'name'
}
.
'.'
]);
$before
=
$this
->
domain
->
getSerial
();
$record
->
content
=
'test'
;
$record
->
save
();
$after
=
$this
->
domain
->
getSerial
();
$this
->
assertTrue
(
$before
<
$after
);
}
/**
* Test deleting DNS records
*/
public
function
testDeleteRecord
():
void
{
$record
=
Record
::
create
([
'domain_id'
=>
$this
->
domain
->
id
,
'name'
=>
$this
->
domain
->{
'name'
},
'type'
=>
"MX"
,
'content'
=>
'10 mx01.'
.
$this
->
domain
->{
'name'
}
.
'.'
]);
$before
=
$this
->
domain
->
getSerial
();
$record
->
delete
();
$after
=
$this
->
domain
->
getSerial
();
$this
->
assertTrue
(
$before
<
$after
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 10:23 AM (23 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18830333
Default Alt Text
RecordTest.php (2 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline