From 5aca2cf6184deaf58f2c4d767645bf9103e915e0 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Wed, 12 Aug 2020 11:32:20 +0200 Subject: [PATCH 1/3] Run tests on PHPUnit 9 and minor clean up --- .travis.yml | 27 ++++++++++++--------------- composer.json | 5 ++++- phpunit.xml.dist | 11 ++++------- tests/ExporterTest.php | 13 +++++++++---- tests/FunctionalTest.php | 2 ++ tests/LoaderTest.php | 7 ++++++- tests/{bootstrap.php => TestCase.php} | 5 ++--- 7 files changed, 39 insertions(+), 31 deletions(-) rename tests/{bootstrap.php => TestCase.php} (94%) diff --git a/.travis.yml b/.travis.yml index 30be35b..815e08a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,26 @@ language: php -php: -# - 5.3 # requires old distro, see below - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - hhvm # ignore errors, see below - # lock distro so future defaults will not break the build dist: trusty -matrix: +jobs: include: - php: 5.3 dist: precise + - php: 5.4 + - php: 5.5 + - php: 5.6 + - php: 7.0 + - php: 7.1 + - php: 7.2 + - php: 7.3 + - php: 7.4 + - php: hhvm-3.18 allow_failures: - - php: hhvm - -sudo: false + - php: hhvm-3.18 install: - - composer install --no-interaction + - composer install script: - vendor/bin/phpunit --coverage-text diff --git a/composer.json b/composer.json index a8c7a0d..bf48b8f 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,12 @@ "clue/graph": "~0.9.0|~0.8.0" }, "require-dev": { - "phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" }, "autoload": { "psr-4": {"Graphp\\GraphML\\": "src/"} + }, + "autoload-dev": { + "psr-4": { "Graphp\\Tests\\GraphML\\": "tests/" } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 92a5b35..e6a5185 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,11 +1,8 @@ - + ./tests/ @@ -16,4 +13,4 @@ ./src - \ No newline at end of file + diff --git a/tests/ExporterTest.php b/tests/ExporterTest.php index d8f3cd0..7017f41 100644 --- a/tests/ExporterTest.php +++ b/tests/ExporterTest.php @@ -1,5 +1,7 @@ exporter = new Exporter(); } @@ -17,7 +22,7 @@ public function testEmpty() $graph = new Graph(); $output = $this->exporter->getOutput($graph); - $xml = new SimpleXMLElement($output); + $xml = new \SimpleXMLElement($output); $this->assertEquals(1, count($xml)); $this->assertEquals(1, count($xml->graph)); @@ -33,7 +38,7 @@ public function testSimple() $v1->createEdge($v2); $output = $this->exporter->getOutput($graph); - $xml = new SimpleXMLElement($output); + $xml = new \SimpleXMLElement($output); $this->assertEquals(1, count($xml->graph->edge)); @@ -52,7 +57,7 @@ public function testSimpleDirected() $v1->createEdgeTo($v2); $output = $this->exporter->getOutput($graph); - $xml = new SimpleXMLElement($output); + $xml = new \SimpleXMLElement($output); $this->assertEquals(1, count($xml->graph->edge)); diff --git a/tests/FunctionalTest.php b/tests/FunctionalTest.php index 69ba05c..47d06f9 100644 --- a/tests/FunctionalTest.php +++ b/tests/FunctionalTest.php @@ -1,5 +1,7 @@ loader = new Loader(); } diff --git a/tests/bootstrap.php b/tests/TestCase.php similarity index 94% rename from tests/bootstrap.php rename to tests/TestCase.php index b211810..d9a3975 100644 --- a/tests/bootstrap.php +++ b/tests/TestCase.php @@ -1,14 +1,13 @@ Date: Wed, 12 Aug 2020 11:32:20 +0200 Subject: [PATCH 2/3] Update PHPUnit configuration schema for PHPUnit 9.3 --- .travis.yml | 3 ++- phpunit.xml.dist | 17 ++++++++++------- phpunit.xml.legacy | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 phpunit.xml.legacy diff --git a/.travis.yml b/.travis.yml index 815e08a..e2743c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,4 +23,5 @@ install: - composer install script: - - vendor/bin/phpunit --coverage-text + - if [[ "$TRAVIS_PHP_VERSION" > "7.2" ]]; then vendor/bin/phpunit --coverage-text; fi + - if [[ "$TRAVIS_PHP_VERSION" < "7.3" ]]; then vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy; fi diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e6a5185..43c615b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,16 +1,19 @@ - + ./tests/ - - - ./src - - + + + ./src/ + + diff --git a/phpunit.xml.legacy b/phpunit.xml.legacy new file mode 100644 index 0000000..9491828 --- /dev/null +++ b/phpunit.xml.legacy @@ -0,0 +1,18 @@ + + + + + + + ./tests/ + + + + + ./src/ + + + From df328aeda2aab8c6d00ab4f26c48478c97f90609 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Wed, 12 Aug 2020 11:38:21 +0200 Subject: [PATCH 3/3] Add .gitattributes to exclude dev files from exports --- .gitattributes | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..e9da46b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +/.gitattributes export-ignore +/.gitignore export-ignore +/.travis.yml export-ignore +/phpunit.xml.dist export-ignore +/phpunit.xml.legacy export-ignore +/tests export-ignore