Skip to content

Commit 9abf79c

Browse files
committed
Run tests on PHPUnit 9
1 parent 8cec07f commit 9abf79c

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
"react/promise": "^3.0 || ^2.7.0 || ^1.2.1"
2424
},
2525
"require-dev": {
26-
"phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35"
26+
"phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.35"
2727
}
2828
}

tests/CallableStub.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/TestCase.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ class TestCase extends BaseTestCase
99
{
1010
protected $loop;
1111

12-
public function setUp()
12+
/**
13+
* @before
14+
*/
15+
public function setUpLoop()
1316
{
1417
$this->loop = Factory::create();
1518
}
@@ -41,7 +44,13 @@ protected function expectCallableNever()
4144
*/
4245
protected function createCallableMock()
4346
{
44-
return $this->getMockBuilder('React\Tests\Promise\Timer\CallableStub')->getMock();
47+
if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) {
48+
// PHPUnit 9+
49+
return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock();
50+
} else {
51+
// legacy PHPUnit 4 - PHPUnit 9
52+
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
53+
}
4554
}
4655

4756
protected function expectPromiseRejected($promise)

0 commit comments

Comments
 (0)