mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
33 lines
923 B
PHP
33 lines
923 B
PHP
|
<?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>";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
?>
|