diff options
author | Matt Butcher <[email protected]> | 2013-04-09 17:47:32 -0500 |
---|---|---|
committer | Matt Butcher <[email protected]> | 2013-04-09 17:47:32 -0500 |
commit | 03f992f08d559f5fdae774cdae4b8dff0ea401ed (patch) | |
tree | 17939fdb710ce8af4d9be82de71f9b8daaacf996 /test/SimpleTest/HTML5/DataHarness.php | |
parent | 35e00ed6d13a694e4f7db1024bf777757bc64bc1 (diff) |
Relocated old tests to SimpleTest dir for reference.
Diffstat (limited to 'test/SimpleTest/HTML5/DataHarness.php')
-rw-r--r-- | test/SimpleTest/HTML5/DataHarness.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/SimpleTest/HTML5/DataHarness.php b/test/SimpleTest/HTML5/DataHarness.php new file mode 100644 index 0000000..844b1fc --- /dev/null +++ b/test/SimpleTest/HTML5/DataHarness.php @@ -0,0 +1,48 @@ +<?php + +/** + * Modified test-case supertype for running tests that are not + * test method based, but based off of test data that resides in + * files. + */ +SimpleTest::ignore('HTML5_DataHarness'); +abstract class HTML5_DataHarness extends UnitTestCase +{ + /** + * Filled in by HTML5_TestData::generateTestCases() + */ + protected $filename; + private $tests; + /** + * Invoked by the runner, it is the function responsible for executing + * the test and delivering results. + * @param $test Some easily usable representation of the test + */ + abstract public function invoke($test); + /** + * Returns a list of tests that can be executed. The list members will + * be passed to invoke(). Return an iterator if you don't want to load + * all test into memory + */ + abstract public function getDataTests(); + /** + * Returns a description of the test + */ + abstract public function getDescription($test); + public function getTests() { + $this->tests = $this->getDataTests(); + // 1-indexed, to be consistent with Python + $ret = array(); + for ($i = 1; $i <= count($this->tests); $i++) { + $ret[] = "test_$i"; + } + return $ret; + } + /** + * Emulates our test functions + */ + public function __call($name, $args) { + list($test, $i) = explode("_", $name); + $this->invoke($this->tests[$i-1]); + } +} |