From 2e109a27a5eb765f64e20d5d823cb9ca2b1ee453 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 31 Mar 2009 19:42:08 +0000 Subject: [PATCH] ENHANCEMENT Allowing to run multiple tests comma-separated in TestRunner, e.g. through dev/tests/ObjectTest,DataObjectTest git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73886 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- dev/TestRunner.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dev/TestRunner.php b/dev/TestRunner.php index 656d062db..f4fae3664 100644 --- a/dev/TestRunner.php +++ b/dev/TestRunner.php @@ -123,17 +123,20 @@ class TestRunner extends Controller { } /** - * Run only a single test class + * Run only a single test class or a comma-separated list of tests */ function only($request) { - $className = $request->param('TestCase'); - if(class_exists($className)) { - if(!(singleton($className) instanceof SapphireTest)) { - user_error("TestRunner::only(): Invalid TestCase '$className', cannot find matching class", E_USER_ERROR); - } - $this->runTests(array($className)); + if ($request->param('TestCase') == 'all') { + $this->all(); } else { - if ($className == 'all') $this->all(); + $classNames = explode(',',$request->param('TestCase')); + foreach($classNames as $className) { + if(!class_exists($className) || !(singleton($className) instanceof SapphireTest)) { + user_error("TestRunner::only(): Invalid TestCase '$className', cannot find matching class", E_USER_ERROR); + } + } + + $this->runTests($classNames); } }