MDL-16483 $CFG->unittestprefix not required anymore to run unit tests that do not need fake db; it should be saer to let admins modify the prefix in config.php instead of modifying it from php

This commit is contained in:
skodak 2009-01-10 16:06:53 +00:00
parent efd8c7fc6b
commit 84ebf08dcc
5 changed files with 163 additions and 153 deletions

View file

@ -8,6 +8,7 @@ Changes:
* Bug fix in simpletest.php and test_case.php. Marked with //moodlefix begins,
//moodlefix ends comments. This has been reported back to the simpletest mailing
list. Hopefully will be included in a future release.
* modified run() in test_case.php - skipping tests that need fake db if prefix not set
skodak, Tim

View file

@ -596,6 +596,16 @@ class TestSuite {
if (is_string($this->_test_cases[$i])) {
$class = $this->_test_cases[$i];
$test = &new $class();
// moodle hack start
global $CFG;
if (empty($CFG->unittestprefix)) {
if ($test instanceof FakeDBUnitTestCase) {
// do not execute this test because test tables not present!
unset($test);
continue;
}
}
// moodle hack end
$test->run($reporter);
unset($test);
} else {