silverstripe-framework/simpletest/UnitTesting.php
Hayden Smith 4a5d9b03f8 Moved Sapphire module to open source path
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@39001 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-07-19 10:40:28 +00:00

33 lines
923 B
PHP
Executable File

<?php
require_once('unit_tester.php');
require_once('reporter.php');
/**
* UnitTesting is a wrapper around the "Simple Test" unit testing framework.
*/
class UnitTesting extends Controller {
function index() {
$test = &new GroupTest("SilverStripe Unit-testing Results for '" . project() . "'");
$builtins = array('UnitTestCase', 'ShellTestCase', 'WebTestCase','SimpleTestCase');
foreach(ClassInfo::subclassesFor("SimpleTestCase") as $testCase) {
if(!in_array($testCase, $builtins)) {
$test->addTestCase($cases[] = new $testCase());
}
}
$test->run(new HtmlReporter());
echo "<h2>What's being tested?</h2>";
foreach($cases as $testCase) {
echo "<li style=\"color: " . ($testCase->testComplete?$testCase->testComplete:'orange') . "\"><b>" . get_class($testCase) . ":</b> ";
echo ($testCase->whatsBeingTested?$testCase->whatsBeingTested:'unknown');
echo "</li>";
}
}
}
?>