Skip to content

Commit e8dd7a1

Browse files
committed
Added test library and test files for nl, com, eu
1 parent 57335a8 commit e8dd7a1

File tree

7 files changed

+120
-16
lines changed

7 files changed

+120
-16
lines changed

DNS/dnsData/dnsRRSIGresult.php

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class dnsRRSIGresult extends dnsResult
1717

1818
public function __construct($type, $algorithm, $labels, $originalttl, $expiration, $inception, $keytag)
1919
{
20+
date_default_timezone_set('UTC');
2021
$types = new DNSTypes();
2122
$this->setTypecovered($types->GetById($type));
2223
$this->setAlgorithm($algorithm);

DNS/dnsData/dnsTypes.php

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ function __construct()
7373
$this->AddType(255,"ANY");
7474
$this->AddType(32768,"TA");
7575
$this->AddType(32769,"DLV");
76+
$this->AddType(65534,"TYPE65534"); // Eurid uses this one?
7677
}
7778

7879
function GetByName($name)

Testfiles/dotcomTest.php

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
include_once("../validate.php");
3+
4+
5+
class dotcomTest extends PHPUnit_Framework_TestCase
6+
{
7+
8+
/**
9+
* Sets up the fixture, for example, opens a network connection.
10+
* This method is called before a test is executed.
11+
*/
12+
protected function setUp()
13+
{
14+
}
15+
16+
/**
17+
* Tears down the fixture, for example, closes a network connection.
18+
* This method is called after a test is executed.
19+
*/
20+
protected function tearDown()
21+
{
22+
}
23+
24+
public function test_Success_Metaregistrarnl()
25+
{
26+
$domainname = 'metaregistrar.com';
27+
$this->assertTrue(validateDomain($domainname));
28+
}
29+
30+
31+
32+
33+
}

Testfiles/doteuTest.php

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
include_once("../validate.php");
3+
4+
5+
class doteuTest extends PHPUnit_Framework_TestCase
6+
{
7+
8+
/**
9+
* Sets up the fixture, for example, opens a network connection.
10+
* This method is called before a test is executed.
11+
*/
12+
protected function setUp()
13+
{
14+
}
15+
16+
/**
17+
* Tears down the fixture, for example, closes a network connection.
18+
* This method is called after a test is executed.
19+
*/
20+
protected function tearDown()
21+
{
22+
}
23+
24+
public function test_Success_Metaregistrareu()
25+
{
26+
$domainname = 'metaregistrar.eu';
27+
$this->assertTrue(validateDomain($domainname));
28+
}
29+
30+
public function test_Success_Eurideu()
31+
{
32+
$domainname = 'eurid.eu';
33+
$this->assertTrue(validateDomain($domainname));
34+
}
35+
36+
37+
}

Testfiles/dotnlTest.php

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
include_once("../validate.php");
3+
4+
5+
class dotnlTest extends PHPUnit_Framework_TestCase
6+
{
7+
8+
/**
9+
* Sets up the fixture, for example, opens a network connection.
10+
* This method is called before a test is executed.
11+
*/
12+
protected function setUp()
13+
{
14+
}
15+
16+
/**
17+
* Tears down the fixture, for example, closes a network connection.
18+
* This method is called after a test is executed.
19+
*/
20+
protected function tearDown()
21+
{
22+
}
23+
24+
public function test_Success_Metaregistrarnl()
25+
{
26+
$domainname = 'metaregistrar.nl';
27+
$this->assertTrue(validateDomain($domainname));
28+
}
29+
30+
public function test_Success_Sidnnl()
31+
{
32+
$domainname = 'sidn.nl';
33+
$this->assertTrue(validateDomain($domainname));
34+
}
35+
36+
37+
}

nbproject/project.properties

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
include.path=${php.global.include.path}
1+
ignore.path=
2+
include.path=\
3+
${php.global.include.path}
24
php.version=PHP_53
5+
phpunit.bootstrap=
6+
phpunit.bootstrap.create.tests=false
7+
phpunit.configuration=
8+
phpunit.run.test.files=true
9+
phpunit.script=
10+
phpunit.suite=
11+
phpunit.test.groups.ask=false
312
source.encoding=UTF-8
413
src.dir=.
514
tags.asp=false
615
tags.short=true
16+
test.src.dir=Testfiles
717
web.root=.

validate.php

-15
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
<?php
22
include_once(dirname(__FILE__).'/DNS/dnsProtocol.php');
33

4-
if ($argc<=1)
5-
{
6-
echo "Usage: validate <domainname>\n";
7-
exit(-1);
8-
}
9-
$domainname = $argv[1];
10-
try
11-
{
12-
validateDomain($domainname);
13-
echo "$domainname dnssec validation succesful\n";
14-
}
15-
catch (DnsException $e)
16-
{
17-
echo "ERROR: ".$e->getMessage()."\n";
18-
}
194

205
function validateDomain($domainname)
216
{

0 commit comments

Comments
 (0)