From ba674c41d7c48f2025dff2bbe25e11ed297b5e60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Thu, 6 Jul 2017 10:39:56 +0200 Subject: [PATCH 1/2] Add PHPUnit to require-dev --- .travis.yml | 2 +- README.md | 16 ++++++++++++++++ composer.json | 3 ++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0c7475b..6cfef86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,4 +17,4 @@ install: - composer install --no-interaction script: - - phpunit --coverage-text + - vendor/bin/phpunit --coverage-text diff --git a/README.md b/README.md index a417680..2041da0 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ It enables you to set and query its data or use its PubSub topics to react to in * [close()](#close) * [end()](#end) * [Install](#install) +* [Tests](#tests) * [License](#license) ## Quickstart example @@ -248,6 +249,21 @@ $ composer require "clue/redis-react:^1.0 || ^0.5" See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades. +## Tests + +To run the test suite, you first need to clone this repo and then install all +dependencies [through Composer](http://getcomposer.org): + +```bash +$ composer install +``` + +To run the test suite, go to the project root and run: + +```bash +$ php vendor/bin/phpunit +``` + ## License MIT diff --git a/composer.json b/composer.json index 4cb6c1f..498f2e3 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,7 @@ "psr-4": { "Clue\\React\\Redis\\": "src/" } }, "require-dev": { - "clue/block-react": "^1.1" + "clue/block-react": "^1.1", + "phpunit/phpunit": "^4.8" } } From ca3de3edb270f7372f9b06f6a0980c140edb4768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Thu, 6 Jul 2017 10:42:28 +0200 Subject: [PATCH 2/2] Compatiblility with PHPUnit v5 --- composer.json | 2 +- tests/FactoryTest.php | 6 ++---- tests/FunctionalTest.php | 1 - tests/StreamingClientTest.php | 4 ++-- tests/bootstrap.php | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 498f2e3..88734f2 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,6 @@ }, "require-dev": { "clue/block-react": "^1.1", - "phpunit/phpunit": "^4.8" + "phpunit/phpunit": "^5.0 || ^4.8" } } diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php index a1c029c..4d17a07 100644 --- a/tests/FactoryTest.php +++ b/tests/FactoryTest.php @@ -1,7 +1,5 @@ loop = $this->getMock('React\EventLoop\LoopInterface'); - $this->connector = $this->getMock('React\SocketClient\ConnectorInterface'); + $this->loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); + $this->connector = $this->getMockBuilder('React\SocketClient\ConnectorInterface')->getMock(); $this->factory = new Factory($this->loop, $this->connector); } diff --git a/tests/FunctionalTest.php b/tests/FunctionalTest.php index 3efe3ac..bf03b94 100644 --- a/tests/FunctionalTest.php +++ b/tests/FunctionalTest.php @@ -1,7 +1,6 @@ stream = $this->getMockBuilder('React\Stream\Stream')->disableOriginalConstructor()->setMethods(array('write', 'close', 'resume', 'pause'))->getMock(); - $this->parser = $this->getMock('Clue\Redis\Protocol\Parser\ParserInterface'); - $this->serializer = $this->getMock('Clue\Redis\Protocol\Serializer\SerializerInterface'); + $this->parser = $this->getMockBuilder('Clue\Redis\Protocol\Parser\ParserInterface')->getMock(); + $this->serializer = $this->getMockBuilder('Clue\Redis\Protocol\Serializer\SerializerInterface')->getMock(); $this->client = new StreamingClient($this->stream, $this->parser, $this->serializer); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index aae34fb..3083fbc 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -49,7 +49,7 @@ protected function expectCallableOnceParameter($type) */ protected function createCallableMock() { - return $this->getMock('CallableStub'); + return $this->getMockBuilder('CallableStub')->getMock(); } protected function expectPromiseResolve($promise)