Skip to content

Commit c27878c

Browse files
authored
Merge pull request #42 from SimonFrings/tests
Run tests on PHPUnit 9 and clean up test suite
2 parents 8cec07f + 2dafff7 commit c27878c

File tree

5 files changed

+13
-20
lines changed

5 files changed

+13
-20
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ matrix:
1616
- php: 7.3
1717
- php: 7.4
1818
- php: hhvm-3.18
19-
install: composer require phpunit/phpunit:^5 --dev --no-interaction # requires legacy phpunit
2019
allow_failures:
2120
- php: hhvm-3.18
2221

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
}

phpunit.xml.dist

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<phpunit bootstrap="vendor/autoload.php"
4-
colors="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
>
3+
<phpunit bootstrap="vendor/autoload.php" colors="true">
94
<testsuites>
105
<testsuite name="Promise Timer Test Suite">
116
<directory>./tests/</directory>

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)