Skip to content

Commit

Permalink
Merge pull request #115 from Lullabot/skip-internet-tests
Browse files Browse the repository at this point in the history
Add the ability to skip tests that require an internet connection
  • Loading branch information
sidkshatriya committed Jun 28, 2016
2 parents 1bc88db + b5a8e4f commit 30344de
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/AmpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
*/
class AmpTest extends PHPUnit_Framework_TestCase
{
/** @var AMP|null */
/** @var AMP */
protected $amp = null;
protected $skip_internet = false;

public function setup()
{
$this->amp = new AMP();
$this->skip_internet = getenv('AMP_TEST_SKIP_INTERNET');
}

/**
Expand All @@ -46,6 +48,10 @@ public function testFiles($test_filename, $fragment)
// An out file does not exist, skip this test
$this->markTestSkipped("$test_filename.out file does not exist. Skipping test.");
}

if (!empty($this->skip_internet) && !empty($options['requires_internet'])) {
$this->markTestSkipped("Skipping test as it requires internet and AMP_TEST_SKIP_INTERNET environment variable is set.");
}
$this->assertEquals($expected_output, $output);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"_readme" : "requires_internet is just for information for the test runner and has no significance for the functioning of library",
"requires_internet": "true"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"_readme" : "requires_internet is just for information for the test runner and has no significance for the functioning of library",
"requires_internet": "true"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"_readme" : "requires_internet is just for information for the test runner and has no significance for the functioning of library",
"requires_internet": "true"
}

0 comments on commit 30344de

Please sign in to comment.