Skip to content

Commit eebb02e

Browse files
committed
Run tests on PHPUnit 9
1 parent b14abb6 commit eebb02e

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
"react/promise": "^2.0 || ^1.0"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": "^7.0 || ^6.0 || ^5.0 || ^4.8.35"
27+
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35"
2828
}
2929
}

tests/DeferredShellTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class DeferredShellTest extends TestCase
88
{
99
private $stream;
1010

11-
public function setUp()
11+
/**
12+
* @before
13+
*/
14+
public function setUpStream()
1215
{
1316
$this->stream = $this->getMockBuilder('React\Stream\DuplexStreamInterface')->getMock();
1417
}

tests/FunctionalTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ class FunctionalTest extends TestCase
1010
private $loop;
1111
private $launcher;
1212

13-
public function setUp()
13+
/**
14+
* @before
15+
*/
16+
public function setUpLauncher()
1417
{
1518
$this->loop = Factory::create();
1619
$this->launcher = new ProcessLauncher($this->loop);

tests/ProcessLauncherTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ class ProcessLauncherTest extends TestCase
99
private $loop;
1010
private $processLauncher;
1111

12-
public function setUp()
12+
/**
13+
* @before
14+
*/
15+
public function setUpProcessLauncher()
1316
{
1417
$this->loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
1518
$this->processLauncher = new ProcessLauncher($this->loop);

tests/TestCase.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ protected function expectCallableOnceParameter($type)
5454

5555
protected function createCallableMock()
5656
{
57-
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
57+
if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) {
58+
// PHPUnit 9+
59+
return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock();
60+
} else {
61+
// legacy PHPUnit 4 - PHPUnit 8
62+
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
63+
}
5864
}
5965

6066
protected function expectPromiseResolve($promise)

0 commit comments

Comments
 (0)