diff --git a/dev/TestListener.php b/dev/TestListener.php new file mode 100644 index 000000000..e6bb43d1f --- /dev/null +++ b/dev/TestListener.php @@ -0,0 +1,48 @@ +getName(); + if(!$this->isValidClass($name)) return; + + $this->class = new $name(); + $this->class->setUpOnce(); + } + + public function endTestSuite(PHPUnit_Framework_TestSuite $suite) { + $name = $suite->getName(); + if(!$this->isValidClass($name)) return; + + $this->class->tearDownOnce(); + } + + /** + * @param String Classname + * @return boolean + */ + protected function isValidClass($name) { + return (class_exists($name) && is_subclass_of($name, 'SapphireTest')); + } +} \ No newline at end of file diff --git a/dev/TestRunner.php b/dev/TestRunner.php index bbb103a89..7d0c4297b 100644 --- a/dev/TestRunner.php +++ b/dev/TestRunner.php @@ -6,6 +6,10 @@ /** * Controller that executes PHPUnit tests. + * + * Alternatively, you can also use the "phpunit" binary directly by + * pointing it to a file or folder containing unit tests. + * See phpunit.dist.xml in the webroot for configuration details. * *

URL Options

* - SkipTests: A comma-separated list of test classes to skip (useful when running dev/tests/all)