From 248f8f885da33dd37109eca207d9438b47f6df21 Mon Sep 17 00:00:00 2001 From: Martijn van der Ven Date: Wed, 8 Aug 2018 14:02:14 +0200 Subject: [PATCH] Filter tests relying on live internet connections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit You may not always have a live internet connection available during testing. By moving all tests that require a live connection into a specific group, they can easily be toggled with `--exclude-group`. The group name “internet” reflects the one used by Guzzle: https://guzzle3.readthedocs.io/testing/unit-testing.html#group-internet-annotation --- README.md | 2 +- tests/Mf2/ParserTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 73f9e9e..75ec029 100644 --- a/README.md +++ b/README.md @@ -347,7 +347,7 @@ Pull requests very welcome, please try to maintain stylistic, structural and nam ### Testing -There are currently two separate test suites: one, in `tests/Mf2`, is written in phpunit, containing many microformats parsing examples as well as internal parser tests and regression tests for specific issues over php-mf2’s history. Run it with `./vendor/bin/phpunit`. +There are currently two separate test suites: one, in `tests/Mf2`, is written in phpunit, containing many microformats parsing examples as well as internal parser tests and regression tests for specific issues over php-mf2’s history. Run it with `./vendor/bin/phpunit`. If you do not have a live internet connection, you can exclude tests that depend on it: `./vendor/bin/phpunit --exclude-group internet`. The other, in `tests/test-suite`, is a custom test harness which hooks up php-mf2 to the cross-platform [microformats test suite](https://github.com/microformats/tests). To run these tests you must first install the tests with `./composer.phar install`. Each test consists of a HTML file and a corresponding JSON file, and the suite can be run with `php ./tests/test-suite/test-suite.php`. diff --git a/tests/Mf2/ParserTest.php b/tests/Mf2/ParserTest.php index 4a3cb2a..90f3f89 100644 --- a/tests/Mf2/ParserTest.php +++ b/tests/Mf2/ParserTest.php @@ -253,7 +253,7 @@ public function testParsesNestedMicroformatsWithClassnamesInAnyOrder() { } /** - * @group network + * @group internet */ public function testFetchMicroformats() { $mf = Mf2\fetch('http://waterpigs.co.uk/'); @@ -367,6 +367,7 @@ public function testApplyTransformationToSrcset() { /** * @see https://github.com/indieweb/php-mf2/issues/84 + * @group internet */ public function testRelativeURLResolvedWithFinalURL() { $mf = Mf2\fetch('http://aaron.pk/4Zn5');