Skip to content

Commit e0d8079

Browse files
committed
Update test instructions to support PHPUnit 6 and PHPUnit 5
1 parent 4d4146c commit e0d8079

6 files changed

Lines changed: 16 additions & 17 deletions

File tree

.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-
- php vendor/bin/phpunit --coverage-text
17+
- vendor/bin/phpunit --coverage-text

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,14 @@ A list of all official components can be found in the [graphp project](https://g
102102
## Tests
103103

104104
This library uses PHPUnit for its extensive test suite.
105-
You can either use a global installation or rely on the one composer installs
106-
when you first run `$ composer install`.
107-
This sets up the developer environment, so that you
108-
can now run it from the project root directory:
105+
To run the test suite, you first need to clone this repo and then install all
106+
dependencies [through Composer](https://getcomposer.org):
107+
108+
```bash
109+
$ composer install
110+
```
111+
112+
To run the test suite, go to the project root and run:
109113

110114
```bash
111115
$ php vendor/bin/phpunit

_config.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"php": "^7.0 || ^5.3"
2626
},
2727
"require-dev": {
28-
"phpunit/phpunit": "~4.0"
28+
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
2929
},
3030
"suggest": {
3131
"graphp/graphviz": "GraphViz graph drawing / DOT output",

tests/GraphTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,15 @@ public function testCreateVerticesNone()
203203
/**
204204
* expect to fail for invalid number of vertices
205205
* @expectedException InvalidArgumentException
206-
* @dataProvider testCreateVerticesFailProvider
206+
* @dataProvider createVerticesFailProvider
207207
*/
208208
public function testCreateVerticesFail($number)
209209
{
210210
$graph = new Graph();
211211
$graph->createVertices($number);
212212
}
213213

214-
public static function testCreateVerticesFailProvider()
214+
public static function createVerticesFailProvider()
215215
{
216216
return array(
217217
array(-1),

tests/TestCase.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
use Fhaculty\Graph\Edge\Base as Edge;
77
use Fhaculty\Graph\Graph;
88
use Fhaculty\Graph\Vertex;
9-
use Fhaculty\Graph\Set\Vertices;
10-
use PHPUnit_Framework_TestCase;
9+
use PHPUnit\Framework\TestCase as BaseTestCase;
1110

12-
class TestCase extends PHPUnit_Framework_TestCase
11+
class TestCase extends BaseTestCase
1312
{
1413
protected function assertGraphEquals(Graph $expected, Graph $actual)
1514
{
@@ -29,11 +28,8 @@ protected function assertGraphEquals(Graph $expected, Graph $actual)
2928
// do not use assertVertexEquals() in order to not increase assertion counter
3029

3130
foreach ($expected->getVertices()->getMap() as $vid => $vertex) {
32-
try {
33-
$other = $actual->getVertex($vid);
34-
} catch (Exception $e) {
35-
$this->fail();
36-
}
31+
$other = $actual->getVertex($vid);
32+
3733
if ($this->getVertexDump($vertex) !== $this->getVertexDump($vertex)) {
3834
$this->fail();
3935
}

0 commit comments

Comments
 (0)