From 47df6a262ccc5b06f44fa6a484a48a08984bee17 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Fri, 17 Jul 2020 13:15:19 +0200 Subject: [PATCH 1/3] Run tests on PHPUnit 9 --- composer.json | 2 +- tests/CallableStub.php | 10 ---------- tests/TestCase.php | 8 +++++++- tests/UnwrapReadableTest.php | 5 ++++- tests/UnwrapWritableTest.php | 5 ++++- 5 files changed, 16 insertions(+), 14 deletions(-) delete mode 100644 tests/CallableStub.php diff --git a/composer.json b/composer.json index 7fe0bc3..8b2899b 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,6 @@ "react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3", "react/promise-timer": "^1.0", "clue/block-react": "^1.0", - "phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.35" } } diff --git a/tests/CallableStub.php b/tests/CallableStub.php deleted file mode 100644 index f398c04..0000000 --- a/tests/CallableStub.php +++ /dev/null @@ -1,10 +0,0 @@ -getMockBuilder('React\Tests\Promise\Stream\CallableStub')->getMock(); + if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) { + // PHPUnit 9+ + return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock(); + } else { + // legacy PHPUnit 4 - PHPUnit 9 + return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock(); + } } protected function expectPromiseResolve($promise) diff --git a/tests/UnwrapReadableTest.php b/tests/UnwrapReadableTest.php index a6db4de..59c578f 100644 --- a/tests/UnwrapReadableTest.php +++ b/tests/UnwrapReadableTest.php @@ -13,7 +13,10 @@ class UnwrapReadableTest extends TestCase { private $loop; - public function setUp() + /** + * @before + */ + public function setUpLoop() { $this->loop = Factory::create(); } diff --git a/tests/UnwrapWritableTest.php b/tests/UnwrapWritableTest.php index 07cc8e3..ecf003c 100644 --- a/tests/UnwrapWritableTest.php +++ b/tests/UnwrapWritableTest.php @@ -14,7 +14,10 @@ class UnwrapWritableTest extends TestCase { private $loop; - public function setUp() + /** + * @before + */ + public function setUpLoop() { $this->loop = Factory::create(); } From f4bdabc307f49947ba402df4861f267e8932cce0 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Fri, 17 Jul 2020 13:34:09 +0200 Subject: [PATCH 2/3] Run tests on PHP 7.4 and simplify test matrix --- .travis.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9bc9e12..145f909 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,23 @@ language: php -php: -# - 5.3 # requires old distro, see below - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - hhvm # ignore errors, see below - # lock distro so new future defaults will not break the build dist: trusty -matrix: +jobs: include: - php: 5.3 dist: precise + - php: 5.4 + - php: 5.5 + - php: 5.6 + - php: 7.0 + - php: 7.1 + - php: 7.2 + - php: 7.3 + - php: 7.4 + - php: hhvm-3.18 allow_failures: - - php: hhvm - -sudo: false + - php: hhvm-3.18 install: - composer install --no-interaction From ab4126fdc07993892426d9dfea36e063d665d10b Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Fri, 17 Jul 2020 13:35:12 +0200 Subject: [PATCH 3/3] Clean up test suite --- phpunit.xml.dist | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a40caa1..e68991a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,11 +1,6 @@ - + ./tests/