Skip to content

Commit

Permalink
Allow use of newer PHPUnit on newer versions of PHP
Browse files Browse the repository at this point in the history
This allows the 0.x series of this library to have passing tests on PHP
5.4 all the way up to PHP 7.3. I added an allowance for using the
PHPUnit 7 series on versions of PHP that support it, and I made a few
slight changes to tests and phpunit.xml.dist that allow the tests to
continue running on both the older version of PHPUnit and the newer
versions.

FYI, when you choose to upgrade to PHPUnit 8.x for the 1.x series of this
library, you'll need to make more changes to the tests that won't be
backwards compatible with earlier versions of PHPUnit.
  • Loading branch information
ramsey committed May 9, 2019
1 parent c08a0f6 commit 88aa071
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"illuminate/contracts": "~5.0",
"mockery/mockery": "~0.9",
"pagerfanta/pagerfanta": "~1.0.0",
"phpunit/phpunit": "^4.8.35",
"phpunit/phpunit": "^4.8.35 || ^7.5",
"squizlabs/php_codesniffer": "~1.5",
"zendframework/zend-paginator": "~2.3"
},
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
Expand Down
4 changes: 2 additions & 2 deletions test/ScopeFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ private function createSut()
*/
private function createManager()
{
return $this->getMock('League\\Fractal\\Manager');
return $this->getMockBuilder('League\\Fractal\\Manager')->getMock();
}

/**
* @return ResourceInterface
*/
private function createResource()
{
return $this->getMock('League\\Fractal\\Resource\\ResourceInterface');
return $this->getMockBuilder('League\\Fractal\\Resource\\ResourceInterface')->getMock();
}
}
3 changes: 2 additions & 1 deletion test/TransformerAbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ public function testParamBagIsProvidedForIncludes()

$transformer->setAvailableIncludes(['book']);
$scope = new Scope($manager, new Item([], $transformer));
$included = $transformer->processIncludedResources($scope, []);

$this->assertFalse($transformer->processIncludedResources($scope, []));
}

/**
Expand Down

0 comments on commit 88aa071

Please sign in to comment.