From 9c10166381351858f396f0e65f49b3d53f617de6 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 25 May 2009 02:29:05 +0000 Subject: [PATCH] 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 --- dev/TestRunner.php | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/dev/TestRunner.php b/dev/TestRunner.php index 0fe955352..262bdf85d 100644 --- a/dev/TestRunner.php +++ b/dev/TestRunner.php @@ -54,6 +54,10 @@ class TestRunner extends Controller { parent::init(); ManifestBuilder::load_test_manifest(); if (!self::$default_reporter) self::set_reporter(Director::is_cli() ? 'CliDebugView' : 'DebugView'); + + if(!hasPhpUnit()) { + die("Please install PHPUnit using pear")); + } } public function Link() { @@ -63,16 +67,12 @@ class TestRunner extends Controller { /** * Run all test classes */ - function all() { - if(hasPhpUnit()) { - $tests = ClassInfo::subclassesFor('SapphireTest'); - array_shift($tests); - unset($tests['FunctionalTest']); - - $this->runTests($tests); - } else { - echo "Please install PHPUnit using pear"; - } + function all() { + $tests = ClassInfo::subclassesFor('SapphireTest'); + array_shift($tests); + unset($tests['FunctionalTest']); + + $this->runTests($tests); } /** @@ -106,16 +106,12 @@ class TestRunner extends Controller { } function coverage() { - if(hasPhpUnit()) { - ManifestBuilder::load_all_classes(); - $tests = ClassInfo::subclassesFor('SapphireTest'); - array_shift($tests); - unset($tests['FunctionalTest']); - - $this->runTests($tests, true); - } else { - echo "Please install PHPUnit using pear"; - } + ManifestBuilder::load_all_classes(); + $tests = ClassInfo::subclassesFor('SapphireTest'); + array_shift($tests); + unset($tests['FunctionalTest']); + + $this->runTests($tests, true); } function cleanupdb() {