Skip to content

Filter tests relying on live internet connections #194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Filter tests relying on live internet connections
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
  • Loading branch information
Zegnat committed Aug 8, 2018
commit 248f8f885da33dd37109eca207d9438b47f6df21
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
3 changes: 2 additions & 1 deletion tests/Mf2/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function testParsesNestedMicroformatsWithClassnamesInAnyOrder() {
}

/**
* @group network
* @group internet
*/
public function testFetchMicroformats() {
$mf = Mf2\fetch('http://waterpigs.co.uk/');
Expand Down Expand Up @@ -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');
Expand Down