Unit tests MDL-24909 Unit tests used 5 minute time limit per test class; this is insufficient for gradebook tests on slow server. Changed to use 60 second limit per test function instead. Added constant and comment defining this behaviour.

This commit is contained in:
Sam Marshall
2010-11-01 15:14:37 +00:00
parent 1865b411fd
commit cf617be64e
3 changed files with 15 additions and 5 deletions
+5 -3
View File
@@ -138,6 +138,11 @@ class SimpleTestCase {
$reporter->paintCaseStart($this->getLabel());
$started = true;
}
//moodlefix begins
if (defined('TIME_ALLOWED_PER_UNIT_TEST')) {
set_time_limit(TIME_ALLOWED_PER_UNIT_TEST);
}
//moodlefix ends
$invoker = &$this->_reporter->createInvoker($this->createInvoker());
$invoker->before($method);
$invoker->invoke($method);
@@ -607,9 +612,6 @@ class TestSuite {
$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')) {
@ini_set('max_execution_time', $currenttl);
}
// moodle hack end
$test = new $class();
$test->run($reporter);