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
This commit is contained in:
Ingo Schommer 2009-03-31 19:42:08 +00:00
parent d2d04d950a
commit 2e109a27a5

View File

@ -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);
}
}