diff --git a/.travis.yml b/.travis.yml index 3464291..ff544ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,24 @@ language: php php: - - 5.3 +# - 5.3 # requires old distro - 5.4 - 5.5 - 5.6 - - 7 - - hhvm + - 7.0 + - 7.1 + - 7.2 + - hhvm # ignore errors, see below + +# lock distro so new future defaults will not break the build +dist: trusty + +matrix: + include: + - php: 5.3 + dist: precise + allow_failures: + - php: hhvm sudo: false @@ -14,4 +26,4 @@ install: - composer install --no-interaction script: - - phpunit --coverage-text + - vendor/bin/phpunit --coverage-text diff --git a/README.md b/README.md index 9897d82..2d2b095 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ enriched with the comfort of [React PHP's Promises/A](https://github.com/reactph * [getName()](#getname) * [getDescription()](#getdescription) * [Install](#install) +* [Tests](#tests) * [License](#license) ## Quickstart example @@ -137,6 +138,21 @@ $ composer require clue/packagist-api-react:^1.1 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](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 diff --git a/composer.json b/composer.json index d75d916..dee2d0c 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,9 @@ "clue/buzz-react": "^1.0 || ^0.5", "rize/uri-template": "^0.3" }, + "require-dev": { + "phpunit/phpunit": "^6.0 || ^5.7 || ^4.8.35" + }, "autoload": { "psr-4": { "Clue\\React\\Packagist\\Api\\": "src/" } } diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 6e114d0..521489e 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -82,7 +82,7 @@ private function setupBrowser($expectedUrl, $promise) private function createResponsePromise($fakeResponseBody) { - $response = $this->getMock('Psr\Http\Message\ResponseInterface'); + $response = $this->getMockBuilder('Psr\Http\Message\ResponseInterface')->getMock(); $response->expects($this->once())->method('getBody')->willReturn($fakeResponseBody); return Promise\resolve($response); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 7c67587..f9aeee5 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,8 +1,10 @@ getMock('CallableStub'); + return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock(); } protected function expectPromiseResolve($promise) @@ -70,11 +69,3 @@ protected function expectPromiseReject($promise) return $promise; } } - -class CallableStub -{ - public function __invoke() - { - } -} -