From efb6d7f4a75b1fb1d21af869a600360e742bc476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Wed, 20 Dec 2017 15:21:10 +0100 Subject: [PATCH 1/2] Forward compatibility with PHPUnit 5 and PHPUnit 6 --- README.md | 16 ++++++++++++++++ composer.json | 2 +- tests/TestCase.php | 6 ++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c426e21..03f5eda 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ provide alternate implementations. * [Fallback get](#fallback-get) * [Fallback-get-and-set](#fallback-get-and-set) * [Install](#install) +* [Tests](#tests) * [License](#license) ## Usage @@ -150,6 +151,21 @@ $ composer require "react/cache:~0.4.0|~0.3.0" More details and upgrade guides can be found in the [CHANGELOG](CHANGELOG.md). +## Tests + +To run the test suite, you first need to clone this repo and then install all +dependencies [through Composer](https://getcomposer.org): + +```bash +$ composer install +``` + +To run the test suite, go to the project root and run: + +```bash +$ php vendor/bin/phpunit +``` + ## License MIT, see [LICENSE file](LICENSE). diff --git a/composer.json b/composer.json index 854099f..9a8bb33 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,6 @@ "psr-4": { "React\\Tests\\Cache\\": "tests/" } }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35" } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 93a04fb..aa449f2 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,7 +2,9 @@ namespace React\Tests\Cache; -class TestCase extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase as BaseTestCase; + +class TestCase extends BaseTestCase { protected function expectCallableExactly($amount) { @@ -36,6 +38,6 @@ protected function expectCallableNever() protected function createCallableMock() { - return $this->getMock('React\Tests\Cache\CallableStub'); + return $this->getMockBuilder('React\Tests\Cache\CallableStub')->getMock(); } } From 7a23d51a1a8c3fbadf8c28b00835542c1844cbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Wed, 20 Dec 2017 15:24:13 +0100 Subject: [PATCH 2/2] Lock Travis distro so new defaults will not break the build --- .travis.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 03b7ecb..290df75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,25 @@ language: php php: - - 5.3 +# - 5.3 # requires old distro, see below - 5.4 - 5.5 - 5.6 - 7 - hhvm +# lock distro so new future defaults will not break the build +dist: trusty + +matrix: + include: + - php: 5.3 + dist: precise + +sudo: false + install: - - composer install --prefer-source --no-interaction + - composer install --no-interaction script: - ./vendor/bin/phpunit --coverage-text