Skip to content

Commit b1f7d2f

Browse files
committed
Run tests on PHPUnit 9
1 parent 040093d commit b1f7d2f

5 files changed

Lines changed: 20 additions & 5 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"require-dev": {
2020
"clue/block-react": "^1.1",
21-
"phpunit/phpunit": "^7.0 || ^5.0 || ^4.8"
21+
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8"
2222
},
2323
"autoload": {
2424
"psr-4": { "Clue\\React\\Zenity\\": "src/" }

tests/FunctionalLauncherTest.php

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

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

tests/TestCase.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ protected function expectCallableNever()
4444
*/
4545
protected function createCallableMock()
4646
{
47-
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->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 8
52+
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
53+
}
4854
}
4955

5056
protected function expectPromiseResolve($promise)

tests/Zen/BaseZenTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ abstract class BaseZenTest extends TestCase
1111
protected $process;
1212
protected $stdin = '';
1313

14-
public function setUp()
14+
/**
15+
* @before
16+
*/
17+
public function setUpMocks()
1518
{
1619
$inbuffer =& $this->stdin;
1720
$this->instream = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();

tests/Zen/FunctionalBaseZenTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88

99
class FunctionalBaseZenTest extends TestCase
1010
{
11-
public function setUp()
11+
/**
12+
* @before
13+
*/
14+
public function setUpLoop()
1215
{
1316
$this->loop = Factory::create();
1417
}

0 commit comments

Comments
 (0)