Conditional mock method
This commit is contained in:
parent
83250394b0
commit
805b303a04
1 changed files with 17 additions and 11 deletions
|
@ -9,6 +9,12 @@ if (
|
||||||
class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase');
|
class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$createMock = 'createMock';
|
||||||
|
|
||||||
|
if (version_compare(PHPUnit_Runner_Version::id(), '5.4', '<=')) {
|
||||||
|
$createMock = 'getMock';
|
||||||
|
}
|
||||||
|
|
||||||
class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +38,7 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testMissingResults()
|
public function testMissingResults()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->$createMock(
|
||||||
'joshtronic\ProjectHoneyPot',
|
'joshtronic\ProjectHoneyPot',
|
||||||
array('dns_get_record'),
|
array('dns_get_record'),
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
|
@ -48,7 +54,7 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory0()
|
public function testCategory0()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->$createMock(
|
||||||
'joshtronic\ProjectHoneyPot',
|
'joshtronic\ProjectHoneyPot',
|
||||||
array('dns_get_record'),
|
array('dns_get_record'),
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
|
@ -66,7 +72,7 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory1()
|
public function testCategory1()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->$createMock(
|
||||||
'joshtronic\ProjectHoneyPot',
|
'joshtronic\ProjectHoneyPot',
|
||||||
array('dns_get_record'),
|
array('dns_get_record'),
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
|
@ -84,7 +90,7 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory2()
|
public function testCategory2()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->$createMock(
|
||||||
'joshtronic\ProjectHoneyPot',
|
'joshtronic\ProjectHoneyPot',
|
||||||
array('dns_get_record'),
|
array('dns_get_record'),
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
|
@ -102,7 +108,7 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory3()
|
public function testCategory3()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->$createMock(
|
||||||
'joshtronic\ProjectHoneyPot',
|
'joshtronic\ProjectHoneyPot',
|
||||||
array('dns_get_record'),
|
array('dns_get_record'),
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
|
@ -123,7 +129,7 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory4()
|
public function testCategory4()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->$createMock(
|
||||||
'joshtronic\ProjectHoneyPot',
|
'joshtronic\ProjectHoneyPot',
|
||||||
array('dns_get_record'),
|
array('dns_get_record'),
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
|
@ -144,7 +150,7 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory5()
|
public function testCategory5()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->$createMock(
|
||||||
'joshtronic\ProjectHoneyPot',
|
'joshtronic\ProjectHoneyPot',
|
||||||
array('dns_get_record'),
|
array('dns_get_record'),
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
|
@ -165,7 +171,7 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory6()
|
public function testCategory6()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->$createMock(
|
||||||
'joshtronic\ProjectHoneyPot',
|
'joshtronic\ProjectHoneyPot',
|
||||||
array('dns_get_record'),
|
array('dns_get_record'),
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
|
@ -186,7 +192,7 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory7()
|
public function testCategory7()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->$createMock(
|
||||||
'joshtronic\ProjectHoneyPot',
|
'joshtronic\ProjectHoneyPot',
|
||||||
array('dns_get_record'),
|
array('dns_get_record'),
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
|
@ -207,7 +213,7 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategoryDefault()
|
public function testCategoryDefault()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->$createMock(
|
||||||
'joshtronic\ProjectHoneyPot',
|
'joshtronic\ProjectHoneyPot',
|
||||||
array('dns_get_record'),
|
array('dns_get_record'),
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
|
@ -228,7 +234,7 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testWithout127()
|
public function testWithout127()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->$createMock(
|
||||||
'joshtronic\ProjectHoneyPot',
|
'joshtronic\ProjectHoneyPot',
|
||||||
array('dns_get_record'),
|
array('dns_get_record'),
|
||||||
array('foobarfoobar')
|
array('foobarfoobar')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue