MDL-21007 UnitTestCaseUsingDatabase misconfigured unit tests now reported as skipped

This commit is contained in:
Eloy Lafuente 2009-11-30 23:18:34 +00:00
parent 776b85474d
commit 2319bdedd6
3 changed files with 12 additions and 1 deletions

View File

@ -68,6 +68,15 @@ class ExHtmlReporter extends HtmlReporter {
$this->_paintPassFail('fail', $message);
}
/**
* Called when a skip needs to be output.
*/
function paintSkip($message) {
// Explicitly call grandparent, not parent::paintFail.
SimpleScorer::paintSkip($message);
$this->_paintPassFail('skip', $message);
}
/**
* Called when an error (uncaught exception or PHP error) needs to be output.
*/
@ -78,7 +87,7 @@ class ExHtmlReporter extends HtmlReporter {
}
/**
* Private method. Used by printPass/Fail/Error.
* Private method. Used by printPass/Fail/Skip/Error.
*/
function _paintPassFail($passorfail, $message, $rawmessage=false) {
global $FULLME, $CFG, $OUTPUT;

View File

@ -40,6 +40,7 @@ $string['runtests'] = 'Run tests';
$string['rununittests'] = 'Run the unit tests';
$string['showpasses'] = 'Show passes as well as fails.';
$string['showsearch'] = 'Show the search for test files.';
$string['skip'] = 'Skip';
$string['stacktrace'] = 'Stack trace:';
$string['summary'] = '{$a->run}/{$a->total} test cases complete: <strong>{$a->passes}</strong> passes, <strong>{$a->fails}</strong> fails and <strong>{$a->exceptions}</strong> exceptions.';
$string['tablesnotsetup'] = 'Unit test tables are not yet built. Do you want to build them now?.';

View File

@ -604,6 +604,7 @@ class TestSuite {
}
if (is_subclass_of($class, 'UnitTestCaseUsingDatabase') && empty($CFG->unittestprefix)) {
// Do not execute this test because $CFG->unittestprefix is not set, but it will be required.
$reporter->paintSkip("Unit test \"{$class}\" of type UnitTestCaseUsingDatabase skipped. Must define different, non-conflicting \$CFG->unittestprefix to be runnable.");
continue;
}
if ($currenttl = @ini_get('max_execution_time')) {