mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Allowing TestRunner? to skip certain tests through the ?SkipTests?=... GET paramete (merged from branches/2.3-nzct)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@80646 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
504980ce4d
commit
17c1d412eb
@ -24,6 +24,9 @@ require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
/**
|
||||
* Controller that executes PHPUnit tests.
|
||||
*
|
||||
* <h2>URL Options</h2>
|
||||
* - SkipTests: A comma-separated list of test classes to skip (useful when running dev/tests/all)
|
||||
*
|
||||
* See {@link browse()} output for generic usage instructions.
|
||||
*
|
||||
@ -75,6 +78,10 @@ class TestRunner extends Controller {
|
||||
$tests = ClassInfo::subclassesFor('SapphireTest');
|
||||
array_shift($tests);
|
||||
unset($tests['FunctionalTest']);
|
||||
foreach($tests as $class => $v) {
|
||||
$reflection = new ReflectionClass($class);
|
||||
if(!$reflection->isInstantiable()) unset($tests[$class]);
|
||||
}
|
||||
|
||||
$this->runTests($tests);
|
||||
}
|
||||
@ -158,6 +165,10 @@ class TestRunner extends Controller {
|
||||
$this->runTests($classNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $classList
|
||||
* @param boolean $coverage
|
||||
*/
|
||||
function runTests($classList, $coverage = false) {
|
||||
// XDEBUG seem to cause problems with test execution :-(
|
||||
if(function_exists('xdebug_disable')) xdebug_disable();
|
||||
@ -166,6 +177,13 @@ class TestRunner extends Controller {
|
||||
|
||||
$this->setUp();
|
||||
|
||||
// Optionally skip certain tests
|
||||
$skipTests = array();
|
||||
if($this->request->getVar('SkipTests')) {
|
||||
$skipTests = explode(',', $this->request->getVar('SkipTests'));
|
||||
}
|
||||
$classList = array_diff($classList, $skipTests);
|
||||
|
||||
// run tests before outputting anything to the client
|
||||
$suite = new PHPUnit_Framework_TestSuite();
|
||||
natcasesort($classList);
|
||||
|
Loading…
Reference in New Issue
Block a user