Skip to content

Commit 1150e0a

Browse files
committed
Update test suite to PHPUnit 7 and legacy PHPUnit versions
1 parent 7c98fda commit 1150e0a

File tree

5 files changed

+22
-25
lines changed

5 files changed

+22
-25
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"php": ">=5.4.0"
1010
},
1111
"require-dev": {
12-
"phpunit/phpunit": "~4.8"
12+
"phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36"
1313
},
1414
"autoload": {
1515
"psr-4": {
@@ -19,7 +19,7 @@
1919
},
2020
"autoload-dev": {
2121
"psr-4": {
22-
"React\\Promise\\": "tests/fixtures"
22+
"React\\Promise\\": ["tests", "tests/fixtures"]
2323
}
2424
},
2525
"keywords": [

phpunit.xml.dist

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
convertWarningsToExceptions="true"
99
processIsolation="false"
1010
stopOnFailure="false"
11-
syntaxCheck="false"
12-
bootstrap="tests/bootstrap.php"
11+
bootstrap="vendor/autoload.php"
1312
>
1413
<testsuites>
1514
<testsuite name="Promise Test Suite">

tests/Stub/CallableStub.php

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

tests/TestCase.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace React\Promise;
44

5-
class TestCase extends \PHPUnit_Framework_TestCase
5+
class TestCase extends \PHPUnit\Framework\TestCase
66
{
77
public function expectCallableExactly($amount)
88
{
@@ -36,8 +36,23 @@ public function expectCallableNever()
3636

3737
public function createCallableMock()
3838
{
39-
return $this
40-
->getMockBuilder('React\\Promise\Stub\CallableStub')
41-
->getMock();
39+
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
40+
}
41+
42+
public function setExpectedException($exception, $exceptionMessage = '', $exceptionCode = null)
43+
{
44+
if (method_exists($this, 'expectException')) {
45+
// PHPUnit 5+
46+
$this->expectException($exception);
47+
if ($exceptionMessage !== '') {
48+
$this->expectExceptionMessage($exceptionMessage);
49+
}
50+
if ($exceptionCode !== null) {
51+
$this->expectExceptionCode($exceptionCode);
52+
}
53+
} else {
54+
// legacy PHPUnit 4
55+
parent::setExpectedException($exception, $exceptionMessage, $exceptionCode);
56+
}
4257
}
4358
}

tests/bootstrap.php

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

0 commit comments

Comments
 (0)