From c6be7af88f68923156cb9a9ad3b9692a573f9784 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 9 Nov 2008 15:34:29 +0000 Subject: [PATCH] ENHANCEMENT Better CLI output for browsing dev/tests git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65464 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- dev/DebugView.php | 2 +- dev/TestRunner.php | 31 ++++++++++++++++++++----------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/dev/DebugView.php b/dev/DebugView.php index c19658ae4..5adbdf11f 100644 --- a/dev/DebugView.php +++ b/dev/DebugView.php @@ -97,7 +97,7 @@ class DebugView { public function writeInfo($title, $subtitle, $description=false) { echo '
'; echo "

" . Convert::raw2xml($title) . "

"; - echo "

" . Convert::raw2xml($subtitle) . "

"; + if($subtitle) echo "

" . Convert::raw2xml($subtitle) . "

"; if ($description) { echo "

$description

"; } else { diff --git a/dev/TestRunner.php b/dev/TestRunner.php index d41c6220f..ad96963fb 100644 --- a/dev/TestRunner.php +++ b/dev/TestRunner.php @@ -79,18 +79,27 @@ class TestRunner extends Controller { */ function browse() { self::$default_reporter->writeHeader(); - echo '
'; - echo '

Available Tests

'; - echo '
'; - echo '
'; - $tests = ClassInfo::subclassesFor('SapphireTest'); - echo "

Link() . "all\">Run all " . count($tests) . " tests

"; - echo "

Link() . "coverage\">Runs all tests and make test coverage report

"; - echo "
"; - foreach ($tests as $test) { - echo "

Link() . "$test\">Run $test

"; + self::$default_reporter->writeInfo('Available Tests', false); + if(Director::is_cli()) { + $tests = ClassInfo::subclassesFor('SapphireTest'); + $relativeLink = Director::makeRelative($this->Link()); + echo "sake {$relativeLink}all: Run all " . count($tests) . " tests\n"; + echo "sake {$relativeLink}coverage: Runs all tests and make test coverage report\n"; + foreach ($tests as $test) { + echo "sake {$relativeLink}$test: Run $test\n"; + } + } else { + echo '
'; + $tests = ClassInfo::subclassesFor('SapphireTest'); + echo "

Link() . "all\">Run all " . count($tests) . " tests

"; + echo "

Link() . "coverage\">Runs all tests and make test coverage report

"; + echo "
"; + foreach ($tests as $test) { + echo "

Link() . "$test\">Run $test

"; + } + echo '
'; } - echo '
'; + self::$default_reporter->writeFooter(); }