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 3b33f15..5623330 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,7 @@ language: php
# lock distro so new future defaults will not break the build
dist: trusty
-matrix:
+jobs:
include:
- php: 5.3
dist: precise
@@ -18,11 +18,10 @@ matrix:
- php: hhvm-3.18
allow_failures:
- php: hhvm-3.18
-
-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 e3d2e93..198ccb5 100644
--- a/composer.json
+++ b/composer.json
@@ -18,7 +18,7 @@
},
"require-dev": {
"clue/block-react": "^1.1",
- "phpunit/phpunit": "^7.0 || ^5.0 || ^4.8"
+ "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8"
},
"autoload": {
"psr-4": { "Clue\\React\\Zenity\\": "src/" }
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index b907049..d502912 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..6534d8d
--- /dev/null
+++ b/phpunit.xml.legacy
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ ./tests/
+
+
+
+
+ ./src/
+
+
+
diff --git a/tests/FunctionalLauncherTest.php b/tests/FunctionalLauncherTest.php
index 6d9b554..addde1d 100644
--- a/tests/FunctionalLauncherTest.php
+++ b/tests/FunctionalLauncherTest.php
@@ -13,7 +13,10 @@ class FunctionalLauncherTest extends TestCase
private $dialog;
private $launcher;
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpLauncher()
{
$this->loop = Factory::create();
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 896d198..7462964 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -44,7 +44,13 @@ protected function expectCallableNever()
*/
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)
diff --git a/tests/Zen/BaseZenTest.php b/tests/Zen/BaseZenTest.php
index 7202461..24ed184 100644
--- a/tests/Zen/BaseZenTest.php
+++ b/tests/Zen/BaseZenTest.php
@@ -11,7 +11,10 @@ abstract class BaseZenTest extends TestCase
protected $process;
protected $stdin = '';
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpMocks()
{
$inbuffer =& $this->stdin;
$this->instream = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
diff --git a/tests/Zen/FunctionalBaseZenTest.php b/tests/Zen/FunctionalBaseZenTest.php
index ba2aa3d..e5cc862 100644
--- a/tests/Zen/FunctionalBaseZenTest.php
+++ b/tests/Zen/FunctionalBaseZenTest.php
@@ -8,7 +8,10 @@
class FunctionalBaseZenTest extends TestCase
{
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpLoop()
{
$this->loop = Factory::create();
}