mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
d2d04d950a
commit
2e109a27a5
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user