Skip to content

Commit 47df6a2

Browse files
committed
Run tests on PHPUnit 9
1 parent a80b842 commit 47df6a2

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
2727
"react/promise-timer": "^1.0",
2828
"clue/block-react": "^1.0",
29-
"phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35"
29+
"phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.35"
3030
}
3131
}

tests/CallableStub.php

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

tests/TestCase.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ protected function expectCallableNever()
5353
*/
5454
protected function createCallableMock()
5555
{
56-
return $this->getMockBuilder('React\Tests\Promise\Stream\CallableStub')->getMock();
56+
if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) {
57+
// PHPUnit 9+
58+
return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock();
59+
} else {
60+
// legacy PHPUnit 4 - PHPUnit 9
61+
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
62+
}
5763
}
5864

5965
protected function expectPromiseResolve($promise)

tests/UnwrapReadableTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ class UnwrapReadableTest extends TestCase
1313
{
1414
private $loop;
1515

16-
public function setUp()
16+
/**
17+
* @before
18+
*/
19+
public function setUpLoop()
1720
{
1821
$this->loop = Factory::create();
1922
}

tests/UnwrapWritableTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ class UnwrapWritableTest extends TestCase
1414
{
1515
private $loop;
1616

17-
public function setUp()
17+
/**
18+
* @before
19+
*/
20+
public function setUpLoop()
1821
{
1922
$this->loop = Factory::create();
2023
}

0 commit comments

Comments
 (0)