8000 Improve test suite by adding PHPUnit to require-dev and test against legacy PHP 5.3 through PHP 7.2 by clue · Pull Request #10 · clue/reactphp-packagist-api · GitHub
[go: up one dir, main page]

Skip to content

Improve test suite by adding PHPUnit to require-dev and test against legacy PHP 5.3 through PHP 7.2 #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
8000
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
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

install:
- composer install --no-interaction

script:
- phpunit --coverage-text
- vendor/bin/phpunit --coverage-text
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/" }
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 4 additions & 13 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

use PHPUnit\Framework\TestCase as BaseTestCase;

require_once __DIR__ . '/../vendor/autoload.php';

class TestCase extends PHPUnit_Framework_TestCase
class TestCase extends BaseTestCase
{
protected function expectCallableOnce()
{
Expand Down Expand Up @@ -44,12 +46,9 @@ protected function expectCallableOnceParameter($type)
return $mock;
}

/**
* @link https://github.com/reactphp/react/blob/master/tests/React/Tests/Socket/TestCase.php (taken from reactphp/react)
*/
protected function createCallableMock()
{
return $this->getMock('CallableStub');
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
}

protected function expectPromiseResolve($promise)
Expand All @@ -70,11 +69,3 @@ protected function expectPromiseReject($promise)
return $promise;
}
}

class CallableStub
{
public function __invoke()
{
}
}

0