Skip to content

Commit

Permalink
Alias TestCase and some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtronic committed Jan 15, 2018
1 parent c83f8a4 commit 8325039
Showing 1 changed file with 51 additions and 33 deletions.
84 changes: 51 additions & 33 deletions tests/ProjectHoneyPotTest.php
Expand Up @@ -2,6 +2,13 @@

require_once '../src/ProjectHoneyPot.php';

if (
!class_exists('\PHPUnit_Framework_TestCase')
&& class_exists('\PHPUnit\Framework\TestCase')
) {
class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase');
}

class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
{
/**
Expand Down Expand Up @@ -31,9 +38,10 @@ public function testMissingResults()
array('foobarfoobar')
);

$mock->expects($this->once())
->method('dns_get_record')
->will($this->returnValue('foo'));
$mock
->expects($this->once())
->method('dns_get_record')
->will($this->returnValue('foo'));

$this->assertFalse($mock->query('1.2.3.4'));
}
Expand All @@ -46,9 +54,10 @@ public function testCategory0()
array('foobarfoobar')
);

$mock->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.0'))));
$mock
->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.0'))));

$results = $mock->query('1.2.3.4');

Expand All @@ -63,9 +72,10 @@ public function testCategory1()
array('foobarfoobar')
);

$mock->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.1'))));
$mock
->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.1'))));

$results = $mock->query('1.2.3.4');

Expand All @@ -80,9 +90,10 @@ public function testCategory2()
array('foobarfoobar')
);

$mock->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.2'))));
$mock
->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.2'))));

$results = $mock->query('1.2.3.4');

Expand All @@ -97,9 +108,10 @@ public function testCategory3()
array('foobarfoobar')
);

$mock->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.3'))));
$mock
->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.3'))));

$results = $mock->query('1.2.3.4');

Expand All @@ -117,9 +129,10 @@ public function testCategory4()
array('foobarfoobar')
);

$mock->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.4'))));
$mock
->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.4'))));

$results = $mock->query('1.2.3.4');

Expand All @@ -137,9 +150,10 @@ public function testCategory5()
array('foobarfoobar')
);

$mock->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.5'))));
$mock
->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.5'))));

$results = $mock->query('1.2.3.4');

Expand All @@ -157,9 +171,10 @@ public function testCategory6()
array('foobarfoobar')
);

$mock->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.6'))));
$mock
->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.6'))));

$results = $mock->query('1.2.3.4');

Expand All @@ -177,9 +192,10 @@ public function testCategory7()
array('foobarfoobar')
);

$mock->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.7'))));
$mock
->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.7'))));

$results = $mock->query('1.2.3.4');

Expand All @@ -197,9 +213,10 @@ public function testCategoryDefault()
array('foobarfoobar')
);

$mock->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.255'))));
$mock
->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.255'))));

$results = $mock->query('1.2.3.4');

Expand All @@ -217,9 +234,10 @@ public function testWithout127()
array('foobarfoobar')
);

$mock->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '1.0.0.0'))));
$mock
->expects($this->once())
->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '1.0.0.0'))));

$this->assertFalse($mock->query('1.2.3.4'));
}
Expand Down

0 comments on commit 8325039

Please sign in to comment.