Skip to content

Commit

Permalink
Merge pull request #61 from clue-labs/phpunit
Browse files Browse the repository at this point in the history
Update test suite to support PHPUnit 9
  • Loading branch information
clue authored Dec 29, 2021
2 parents f3a250a + 9618a70 commit dad0e9f
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/.gitignore export-ignore
/bin/build.php export-ignore
/phpunit.xml.dist export-ignore
/phpunit.xml.legacy export-ignore
/tests/ export-ignore
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
coverage: xdebug
- run: composer install
- run: vendor/bin/phpunit --coverage-text
if: ${{ matrix.php >= 7.3 }}
- run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
if: ${{ matrix.php < 7.3 }}
- run: composer build

PHPUnit-hhvm:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"require-dev": {
"clue/phar-composer": "^1.3",
"phpunit/phpunit": "^4.8.36"
"phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.36"
},
"autoload": {
"psr-0": { "Clue\\GraphComposer": "src/" }
Expand Down
20 changes: 13 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit colors="true" bootstrap="vendor/autoload.php">
<!-- PHPUnit configuration file with new format for PHPUnit 9.5+ -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResult="false"
colors="true"
convertDeprecationsToExceptions="true">
<testsuites>
<testsuite name="GraphComposer Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
</phpunit>
<coverage>
<include>
<directory>./src/</directory>
</include>
</coverage>
</phpunit>
18 changes: 18 additions & 0 deletions phpunit.xml.legacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- PHPUnit configuration file with old format before PHPUnit 9 -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="GraphComposer Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
3 changes: 2 additions & 1 deletion tests/AppTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use Clue\GraphComposer\App;
use PHPUnit\Framework\TestCase;

class AppTest extends PHPUnit_Framework_TestCase
class AppTest extends TestCase
{
public function testVersionReturnsDev()
{
Expand Down
5 changes: 3 additions & 2 deletions tests/GraphComposerTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use Clue\GraphComposer\Graph\GraphComposer;
use Graphp\GraphViz\GraphViz;
use Fhaculty\Graph\Graph;
use Graphp\GraphViz\GraphViz;
use PHPUnit\Framework\TestCase;

class GraphVizMockDisplay extends GraphViz
{
Expand Down Expand Up @@ -31,7 +32,7 @@ public function setFormat($format)
}
}

class GraphTest extends PHPUnit_Framework_TestCase
class GraphTest extends TestCase
{
public function testCreateGraph()
{
Expand Down

0 comments on commit dad0e9f

Please sign in to comment.