From 1a0585326384ab2270d56778ea853f76a70a49ef Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Fri, 17 Jul 2020 10:46:19 +0200 Subject: [PATCH 1/3] Run tests on PHPUnit 9 --- composer.json | 2 +- tests/ArrayCacheTest.php | 5 ++++- tests/CallableStub.php | 10 ---------- tests/TestCase.php | 8 +++++++- 4 files changed, 12 insertions(+), 13 deletions(-) delete mode 100644 tests/CallableStub.php diff --git a/composer.json b/composer.json index a8f4a43..ae9c39f 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,6 @@ "psr-4": { "React\\Tests\\Cache\\": "tests/" } }, "require-dev": { - "phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.35" } } diff --git a/tests/ArrayCacheTest.php b/tests/ArrayCacheTest.php index 3b5bd8c..420d45f 100644 --- a/tests/ArrayCacheTest.php +++ b/tests/ArrayCacheTest.php @@ -11,7 +11,10 @@ class ArrayCacheTest extends TestCase */ private $cache; - public function setUp() + /** + * @before + */ + public function setUpArrayCache() { $this->cache = new ArrayCache(); } diff --git a/tests/CallableStub.php b/tests/CallableStub.php deleted file mode 100644 index 2f547cd..0000000 --- a/tests/CallableStub.php +++ /dev/null @@ -1,10 +0,0 @@ -getMockBuilder('React\Tests\Cache\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(); + } } } From c393d4c06f399870af27f3bbc793c64dd5a6ed45 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Fri, 17 Jul 2020 10:55:41 +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 402a996..0a5430e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,5 @@ 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 # requires legacy phpunit & ignore errors, see below - # lock distro so new future defaults will not break the build dist: trusty @@ -18,10 +7,17 @@ matrix: include: - php: 5.3 dist: precise - - php: hhvm - install: composer require phpunit/phpunit:^5 --dev --no-interaction + - 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 + - php: hhvm-3.18 sudo: false @@ -29,4 +25,4 @@ install: - composer install --no-interaction script: - - ./vendor/bin/phpunit --coverage-text + - vendor/bin/phpunit --coverage-text From 49bbd0c4c796426d0acc90f5ce655e3f31cd7d94 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Fri, 17 Jul 2020 10:59:14 +0200 Subject: [PATCH 3/3] Clean up test suite --- .travis.yml | 4 +--- phpunit.xml.dist | 7 +------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0a5430e..1c59030 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 @@ -19,8 +19,6 @@ matrix: allow_failures: - php: hhvm-3.18 -sudo: false - install: - composer install --no-interaction diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d02182f..0e947b8 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,11 +1,6 @@ - + ./tests/