diff --git a/.gitattributes b/.gitattributes
index 0925d33..eccc763 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -3,4 +3,5 @@
/.travis.yml export-ignore
/examples/ export-ignore
/phpunit.xml.dist export-ignore
+/phpunit.xml.legacy export-ignore
/tests/ export-ignore
diff --git a/.travis.yml b/.travis.yml
index 845ce05..9511e94 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,7 @@ language: php
# lock distro so future defaults will not break the build
dist: trusty
-matrix:
+jobs:
include:
- php: 5.3
dist: precise
@@ -16,10 +16,9 @@ matrix:
- php: 7.3
- php: 7.4
-sudo: false
-
install:
- - composer install --no-interaction
+ - composer install
script:
- - vendor/bin/phpunit --coverage-text
+ - if [[ "$TRAVIS_PHP_VERSION" > "7.2" ]]; then vendor/bin/phpunit --coverage-text; fi
+ - if [[ "$TRAVIS_PHP_VERSION" < "7.3" ]]; then vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy; fi
diff --git a/composer.json b/composer.json
index a5cbbb0..dff6470 100644
--- a/composer.json
+++ b/composer.json
@@ -24,6 +24,6 @@
"react/promise": "^2.0 || ^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^7.0 || ^6.0 || ^5.0 || ^4.8.35"
+ "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35"
}
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 471539b..8ef3e91 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,14 +1,19 @@
-
+
+
./tests/
-
-
+
+
./src/
-
-
-
\ No newline at end of file
+
+
+
diff --git a/phpunit.xml.legacy b/phpunit.xml.legacy
new file mode 100644
index 0000000..dc15861
--- /dev/null
+++ b/phpunit.xml.legacy
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ ./tests/
+
+
+
+
+ ./src/
+
+
+
diff --git a/tests/DeferredShellTest.php b/tests/DeferredShellTest.php
index 2dabfb7..5825b33 100644
--- a/tests/DeferredShellTest.php
+++ b/tests/DeferredShellTest.php
@@ -8,7 +8,10 @@ class DeferredShellTest extends TestCase
{
private $stream;
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpStream()
{
$this->stream = $this->getMockBuilder('React\Stream\DuplexStreamInterface')->getMock();
}
diff --git a/tests/FunctionalTest.php b/tests/FunctionalTest.php
index 456724d..1434549 100644
--- a/tests/FunctionalTest.php
+++ b/tests/FunctionalTest.php
@@ -10,7 +10,10 @@ class FunctionalTest extends TestCase
private $loop;
private $launcher;
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpLauncher()
{
$this->loop = Factory::create();
$this->launcher = new ProcessLauncher($this->loop);
diff --git a/tests/ProcessLauncherTest.php b/tests/ProcessLauncherTest.php
index 884e03d..3e4a68a 100644
--- a/tests/ProcessLauncherTest.php
+++ b/tests/ProcessLauncherTest.php
@@ -9,7 +9,10 @@ class ProcessLauncherTest extends TestCase
private $loop;
private $processLauncher;
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpProcessLauncher()
{
$this->loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
$this->processLauncher = new ProcessLauncher($this->loop);
diff --git a/tests/TestCase.php b/tests/TestCase.php
index b6fe2bd..052104a 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -54,7 +54,13 @@ protected function expectCallableOnceParameter($type)
protected function createCallableMock()
{
- return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
+ if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) {
+ // PHPUnit 9+
+ return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock();
+ } else {
+ // legacy PHPUnit 4 - PHPUnit 8
+ return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
+ }
}
protected function expectPromiseResolve($promise)