Skip to content

Commit

Permalink
PHP 5.3 BC fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean85 committed Jul 29, 2015
1 parent 4d31ec1 commit 2e5b5ee
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/Paraunit/Tests/Unit/Filter/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ public function testFilterTestFiles_gets_only_requested_testsuite()
->shouldBeCalled();

$fileIterator = $this->prophesize(\File_Iterator_Facade::class);
$fileIterator->getFilesAsArray('./only/selected/test/suite/', 'Test.php', null, [])
->willReturn(['OnlyTestSuiteTest.php'])
$fileIterator->getFilesAsArray('./only/selected/test/suite/', 'Test.php', null, array())
->willReturn(array('OnlyTestSuiteTest.php'))
->shouldBeCalledTimes(1);
$fileIterator->getFilesAsArray('./other/test/suite/', 'Test.php', '', [])
->willReturn(['OtherTest.php'])
$fileIterator->getFilesAsArray('./other/test/suite/', 'Test.php', '', array())
->willReturn(array('OtherTest.php'))
->shouldNotBeCalled();

$filter = new Filter($utilXml->reveal(), $fileIterator->reveal());

$result = $filter->filterTestFiles($configFile, $testSuiteName);

$this->assertCount(1, $result);
$this->assertEquals(['OnlyTestSuiteTest.php'], $result);
$this->assertEquals(array('OnlyTestSuiteTest.php'), $result);
}

public function testFilterTestFiles_supports_suffix_attribute()
Expand All @@ -43,17 +43,17 @@ public function testFilterTestFiles_supports_suffix_attribute()
->shouldBeCalled();

$fileIterator = $this->prophesize(\File_Iterator_Facade::class);
$fileIterator->getFilesAsArray('./only/selected/test/suite/', 'TestSuffix.php', null, [])
->willReturn(['OneTestSuffix.php'])
$fileIterator->getFilesAsArray('./only/selected/test/suite/', 'TestSuffix.php', null, array())
->willReturn(array('OneTestSuffix.php'))
->shouldBeCalledTimes(1);
$fileIterator->getFilesAsArray('./other/test/suite/', 'Test.php', null, [])
->willReturn(['OtherTest.php'])
$fileIterator->getFilesAsArray('./other/test/suite/', 'Test.php', null, array())
->willReturn(array('OtherTest.php'))
->shouldBeCalledTimes(1);

$filter = new Filter($utilXml->reveal(), $fileIterator->reveal());

$result = $filter->filterTestFiles($configFile);
$this->assertEquals(['OneTestSuffix.php', 'OtherTest.php'], $result);
$this->assertEquals(array('OneTestSuffix.php', 'OtherTest.php'), $result);
}

public function testFilterTestFiles_supports_prefix_attribute()
Expand All @@ -66,17 +66,17 @@ public function testFilterTestFiles_supports_prefix_attribute()
->shouldBeCalled();

$fileIterator = $this->prophesize(\File_Iterator_Facade::class);
$fileIterator->getFilesAsArray('./only/selected/test/suite/', 'Test.php', 'TestPrefix', [])
->willReturn(['TestPrefixOneTest.php'])
$fileIterator->getFilesAsArray('./only/selected/test/suite/', 'Test.php', 'TestPrefix', array())
->willReturn(array('TestPrefixOneTest.php'))
->shouldBeCalledTimes(1);
$fileIterator->getFilesAsArray('./other/test/suite/', 'Test.php', null, [])
->willReturn(['OtherTest.php'])
$fileIterator->getFilesAsArray('./other/test/suite/', 'Test.php', null, array())
->willReturn(array('OtherTest.php'))
->shouldBeCalledTimes(1);

$filter = new Filter($utilXml->reveal(), $fileIterator->reveal());

$result = $filter->filterTestFiles($configFile);
$this->assertEquals(['TestPrefixOneTest.php', 'OtherTest.php'], $result);
$this->assertEquals(array('TestPrefixOneTest.php', 'OtherTest.php'), $result);
}

public function testFilterTestFiles_avoids_duplicate_runs()
Expand All @@ -89,18 +89,18 @@ public function testFilterTestFiles_avoids_duplicate_runs()
->shouldBeCalled();

$fileIterator = $this->prophesize(\File_Iterator_Facade::class);
$fileIterator->getFilesAsArray('./only/selected/test/suite/', 'Test.php', null, [])
->willReturn(['SameFile.php'])
$fileIterator->getFilesAsArray('./only/selected/test/suite/', 'Test.php', null, array())
->willReturn(array('SameFile.php'))
->shouldBeCalledTimes(1);
$fileIterator->getFilesAsArray('./other/test/suite/', 'Test.php', null, [])
->willReturn(['SameFile.php'])
$fileIterator->getFilesAsArray('./other/test/suite/', 'Test.php', null, array())
->willReturn(array('SameFile.php'))
->shouldBeCalledTimes(1);

$filter = new Filter($utilXml->reveal(), $fileIterator->reveal());

$result = $filter->filterTestFiles($configFile);
$this->assertCount(1, $result);
$this->assertEquals(['SameFile.php'], $result);
$this->assertEquals(array('SameFile.php'), $result);
}

/**
Expand Down

0 comments on commit 2e5b5ee

Please sign in to comment.