Alias TestCase and some cleanup
This commit is contained in:
parent
ba8f480f5e
commit
ddfe2b126a
1 changed files with 51 additions and 33 deletions
|
@ -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,9 +38,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
);
|
);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock
|
||||||
->method('dns_get_record')
|
->expects($this->once())
|
||||||
->will($this->returnValue('foo'));
|
->method('dns_get_record')
|
||||||
|
->will($this->returnValue('foo'));
|
||||||
|
|
||||||
$this->assertFalse($mock->query('1.2.3.4'));
|
$this->assertFalse($mock->query('1.2.3.4'));
|
||||||
}
|
}
|
||||||
|
@ -46,9 +54,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
);
|
);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock
|
||||||
->method('dns_get_record')
|
->expects($this->once())
|
||||||
->will($this->returnValue(array(array('ip' => '127.0.0.0'))));
|
->method('dns_get_record')
|
||||||
|
->will($this->returnValue(array(array('ip' => '127.0.0.0'))));
|
||||||
|
|
||||||
$results = $mock->query('1.2.3.4');
|
$results = $mock->query('1.2.3.4');
|
||||||
|
|
||||||
|
@ -63,9 +72,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
);
|
);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock
|
||||||
->method('dns_get_record')
|
->expects($this->once())
|
||||||
->will($this->returnValue(array(array('ip' => '127.0.0.1'))));
|
->method('dns_get_record')
|
||||||
|
->will($this->returnValue(array(array('ip' => '127.0.0.1'))));
|
||||||
|
|
||||||
$results = $mock->query('1.2.3.4');
|
$results = $mock->query('1.2.3.4');
|
||||||
|
|
||||||
|
@ -80,9 +90,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
);
|
);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock
|
||||||
->method('dns_get_record')
|
->expects($this->once())
|
||||||
->will($this->returnValue(array(array('ip' => '127.0.0.2'))));
|
->method('dns_get_record')
|
||||||
|
->will($this->returnValue(array(array('ip' => '127.0.0.2'))));
|
||||||
|
|
||||||
$results = $mock->query('1.2.3.4');
|
$results = $mock->query('1.2.3.4');
|
||||||
|
|
||||||
|
@ -97,9 +108,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
);
|
);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock
|
||||||
->method('dns_get_record')
|
->expects($this->once())
|
||||||
->will($this->returnValue(array(array('ip' => '127.0.0.3'))));
|
->method('dns_get_record')
|
||||||
|
->will($this->returnValue(array(array('ip' => '127.0.0.3'))));
|
||||||
|
|
||||||
$results = $mock->query('1.2.3.4');
|
$results = $mock->query('1.2.3.4');
|
||||||
|
|
||||||
|
@ -117,9 +129,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
);
|
);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock
|
||||||
->method('dns_get_record')
|
->expects($this->once())
|
||||||
->will($this->returnValue(array(array('ip' => '127.0.0.4'))));
|
->method('dns_get_record')
|
||||||
|
->will($this->returnValue(array(array('ip' => '127.0.0.4'))));
|
||||||
|
|
||||||
$results = $mock->query('1.2.3.4');
|
$results = $mock->query('1.2.3.4');
|
||||||
|
|
||||||
|
@ -137,9 +150,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
);
|
);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock
|
||||||
->method('dns_get_record')
|
->expects($this->once())
|
||||||
->will($this->returnValue(array(array('ip' => '127.0.0.5'))));
|
->method('dns_get_record')
|
||||||
|
->will($this->returnValue(array(array('ip' => '127.0.0.5'))));
|
||||||
|
|
||||||
$results = $mock->query('1.2.3.4');
|
$results = $mock->query('1.2.3.4');
|
||||||
|
|
||||||
|
@ -157,9 +171,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
);
|
);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock
|
||||||
->method('dns_get_record')
|
->expects($this->once())
|
||||||
->will($this->returnValue(array(array('ip' => '127.0.0.6'))));
|
->method('dns_get_record')
|
||||||
|
->will($this->returnValue(array(array('ip' => '127.0.0.6'))));
|
||||||
|
|
||||||
$results = $mock->query('1.2.3.4');
|
$results = $mock->query('1.2.3.4');
|
||||||
|
|
||||||
|
@ -177,9 +192,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
);
|
);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock
|
||||||
->method('dns_get_record')
|
->expects($this->once())
|
||||||
->will($this->returnValue(array(array('ip' => '127.0.0.7'))));
|
->method('dns_get_record')
|
||||||
|
->will($this->returnValue(array(array('ip' => '127.0.0.7'))));
|
||||||
|
|
||||||
$results = $mock->query('1.2.3.4');
|
$results = $mock->query('1.2.3.4');
|
||||||
|
|
||||||
|
@ -197,9 +213,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
);
|
);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock
|
||||||
->method('dns_get_record')
|
->expects($this->once())
|
||||||
->will($this->returnValue(array(array('ip' => '127.0.0.255'))));
|
->method('dns_get_record')
|
||||||
|
->will($this->returnValue(array(array('ip' => '127.0.0.255'))));
|
||||||
|
|
||||||
$results = $mock->query('1.2.3.4');
|
$results = $mock->query('1.2.3.4');
|
||||||
|
|
||||||
|
@ -217,9 +234,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
);
|
);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock
|
||||||
->method('dns_get_record')
|
->expects($this->once())
|
||||||
->will($this->returnValue(array(array('ip' => '1.0.0.0'))));
|
->method('dns_get_record')
|
||||||
|
->will($this->returnValue(array(array('ip' => '1.0.0.0'))));
|
||||||
|
|
||||||
$this->assertFalse($mock->query('1.2.3.4'));
|
$this->assertFalse($mock->query('1.2.3.4'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue