BUGFIX Failing in TestRunner->init() when PHPUnit is not present, not only in specific method invocations. Previously it was missing checks on only() method

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77704 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-05-25 02:29:05 +00:00
parent 86388328a1
commit 9c10166381

View File

@ -54,6 +54,10 @@ class TestRunner extends Controller {
parent::init(); parent::init();
ManifestBuilder::load_test_manifest(); ManifestBuilder::load_test_manifest();
if (!self::$default_reporter) self::set_reporter(Director::is_cli() ? 'CliDebugView' : 'DebugView'); if (!self::$default_reporter) self::set_reporter(Director::is_cli() ? 'CliDebugView' : 'DebugView');
if(!hasPhpUnit()) {
die("Please install PHPUnit using pear"));
}
} }
public function Link() { public function Link() {
@ -64,15 +68,11 @@ class TestRunner extends Controller {
* Run all test classes * Run all test classes
*/ */
function all() { function all() {
if(hasPhpUnit()) {
$tests = ClassInfo::subclassesFor('SapphireTest'); $tests = ClassInfo::subclassesFor('SapphireTest');
array_shift($tests); array_shift($tests);
unset($tests['FunctionalTest']); unset($tests['FunctionalTest']);
$this->runTests($tests); $this->runTests($tests);
} else {
echo "Please install PHPUnit using pear";
}
} }
/** /**
@ -106,16 +106,12 @@ class TestRunner extends Controller {
} }
function coverage() { function coverage() {
if(hasPhpUnit()) {
ManifestBuilder::load_all_classes(); ManifestBuilder::load_all_classes();
$tests = ClassInfo::subclassesFor('SapphireTest'); $tests = ClassInfo::subclassesFor('SapphireTest');
array_shift($tests); array_shift($tests);
unset($tests['FunctionalTest']); unset($tests['FunctionalTest']);
$this->runTests($tests, true); $this->runTests($tests, true);
} else {
echo "Please install PHPUnit using pear";
}
} }
function cleanupdb() { function cleanupdb() {