Skip to content

Commit c974da0

Browse files
committed
Run tests on PHPUnit 9
1 parent f3cff96 commit c974da0

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"php": ">=5.4.0"
1010
},
1111
"require-dev": {
12-
"phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36"
12+
"phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.36"
1313
},
1414
"autoload": {
1515
"psr-4": {

tests/TestCase.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ public function expectCallableNever()
3636

3737
public function createCallableMock()
3838
{
39-
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
39+
if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) {
40+
// PHPUnit 10+
41+
return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock();
42+
} else {
43+
// legacy PHPUnit 4 - PHPUnit 9
44+
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
45+
}
4046
}
4147

4248
public function setExpectedException($exception, $exceptionMessage = '', $exceptionCode = null)

0 commit comments

Comments
 (0)