Alias TestCase and some cleanup

This commit is contained in:
Josh Sherman 2018-01-14 22:56:33 -06:00
parent ba8f480f5e
commit ddfe2b126a
No known key found for this signature in database
GPG key ID: 55B058A80530EF22

View file

@ -2,6 +2,13 @@
require_once '../src/ProjectHoneyPot.php'; 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 class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
{ {
/** /**
@ -31,7 +38,8 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
array('foobarfoobar') array('foobarfoobar')
); );
$mock->expects($this->once()) $mock
->expects($this->once())
->method('dns_get_record') ->method('dns_get_record')
->will($this->returnValue('foo')); ->will($this->returnValue('foo'));
@ -46,7 +54,8 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
array('foobarfoobar') array('foobarfoobar')
); );
$mock->expects($this->once()) $mock
->expects($this->once())
->method('dns_get_record') ->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.0')))); ->will($this->returnValue(array(array('ip' => '127.0.0.0'))));
@ -63,7 +72,8 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
array('foobarfoobar') array('foobarfoobar')
); );
$mock->expects($this->once()) $mock
->expects($this->once())
->method('dns_get_record') ->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.1')))); ->will($this->returnValue(array(array('ip' => '127.0.0.1'))));
@ -80,7 +90,8 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
array('foobarfoobar') array('foobarfoobar')
); );
$mock->expects($this->once()) $mock
->expects($this->once())
->method('dns_get_record') ->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.2')))); ->will($this->returnValue(array(array('ip' => '127.0.0.2'))));
@ -97,7 +108,8 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
array('foobarfoobar') array('foobarfoobar')
); );
$mock->expects($this->once()) $mock
->expects($this->once())
->method('dns_get_record') ->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.3')))); ->will($this->returnValue(array(array('ip' => '127.0.0.3'))));
@ -117,7 +129,8 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
array('foobarfoobar') array('foobarfoobar')
); );
$mock->expects($this->once()) $mock
->expects($this->once())
->method('dns_get_record') ->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.4')))); ->will($this->returnValue(array(array('ip' => '127.0.0.4'))));
@ -137,7 +150,8 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
array('foobarfoobar') array('foobarfoobar')
); );
$mock->expects($this->once()) $mock
->expects($this->once())
->method('dns_get_record') ->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.5')))); ->will($this->returnValue(array(array('ip' => '127.0.0.5'))));
@ -157,7 +171,8 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
array('foobarfoobar') array('foobarfoobar')
); );
$mock->expects($this->once()) $mock
->expects($this->once())
->method('dns_get_record') ->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.6')))); ->will($this->returnValue(array(array('ip' => '127.0.0.6'))));
@ -177,7 +192,8 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
array('foobarfoobar') array('foobarfoobar')
); );
$mock->expects($this->once()) $mock
->expects($this->once())
->method('dns_get_record') ->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.7')))); ->will($this->returnValue(array(array('ip' => '127.0.0.7'))));
@ -197,7 +213,8 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
array('foobarfoobar') array('foobarfoobar')
); );
$mock->expects($this->once()) $mock
->expects($this->once())
->method('dns_get_record') ->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '127.0.0.255')))); ->will($this->returnValue(array(array('ip' => '127.0.0.255'))));
@ -217,7 +234,8 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
array('foobarfoobar') array('foobarfoobar')
); );
$mock->expects($this->once()) $mock
->expects($this->once())
->method('dns_get_record') ->method('dns_get_record')
->will($this->returnValue(array(array('ip' => '1.0.0.0')))); ->will($this->returnValue(array(array('ip' => '1.0.0.0'))));