8000 Improve test instructions and add PHPUnit to require-dev · clue/reactphp-packagist-api@915fff3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 915fff3

Browse files
committed
Improve test instructions and add PHPUnit to require-dev
1 parent c06de0e commit 915fff3

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ install:
1414
- composer install --no-interaction
1515

1616
script:
17-
- phpunit --coverage-text
17+
- vendor/bin/phpunit --coverage-text

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ enriched with the comfort of [React PHP's Promises/A](https://github.com/reactph
2525
* [getName()](#getname)
2626
* [getDescription()](#getdescription)
2727
* [Install](#install)
28+
* [Tests](#tests)
2829
* [License](#license)
2930

3031
## Quickstart example
@@ -137,6 +138,21 @@ $ composer require clue/packagist-api-react:^1.1
137138

138139
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
139140

141+
## Tests
142+
143+
To run the test suite, you first need to clone this repo and then install all
144+
dependencies [through Composer](https://getcomposer.org):
145+
146+
```bash
147+
$ composer install
148+
```
149+
150+
To run the test suite, go to the project root and run:
151+
152+
```bash
153+
$ php vendor/bin/phpunit
154+
```
155+
140156
## License
141157

142158
MIT

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"clue/buzz-react": "^1.0 || ^0.5",
1717
"rize/uri-template": "^0.3"
1818
},
19+
"require-dev": {
20+
"phpunit/phpunit": "^6.0 || ^5.7 || ^4.8.35"
21+
},
1922
"autoload": {
2023
"psr-4": { "Clue\\React\\Packagist\\Api\\": "src/" }
2124
}

tests/ClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private function setupBrowser($expectedUrl, $promise)
8282

8383
private function createResponsePromise($fakeResponseBody)
8484
{
85-
$response = $this->getMock('Psr\Http\Message\ResponseInterface');
85+
$response = $this->getMockBuilder('Psr\Http\Message\ResponseInterface')->getMock();
8686
$response->expects($this->once())->method('getBody')->willReturn($fakeResponseBody);
8787

8888
return Promise\resolve($response);

tests/bootstrap.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22

3+
use PHPUnit\Framework\TestCase as BaseTestCase;
4+
35
require_once __DIR__ . '/../vendor/autoload.php';
46

5-
class TestCase extends PHPUnit_Framework_TestCase
7+
class TestCase extends BaseTestCase
68
{
79
protected function expectCallableOnce()
810
{
@@ -44,12 +46,9 @@ protected function expectCallableOnceParameter($type)
4446
return $mock;
4547
}
4648

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

5554
protected function expectPromiseResolve($promise)
@@ -70,11 +69,3 @@ protected function expectPromiseReject($promise)
7069
return $promise;
7170
}
7271
}
73-
74-
class CallableStub
75-
{
76-
public function __invoke()
77-
{
78-
}
79-
}
80-

0 commit comments

Comments
 (0)
0