unit tests: MDL-17803 test classes were not getting destroyed at the right time, which was breaking the code that reset the test DB to the normal DB.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
Description of SimpleTest Version: 1.0.1 library import
|
||||
|
||||
Obtained from http://www.simpletest.org/en/download.html
|
||||
|
||||
Moodle-specific 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.
|
||||
|
||||
Tim.
|
||||
@@ -276,6 +276,19 @@ class SimpleTestContext {
|
||||
$this->_test = &$test;
|
||||
}
|
||||
|
||||
//moodlefix begins
|
||||
/**
|
||||
* Unsets the current test case instance. Avoids
|
||||
* problems when test classes rely on their destructors
|
||||
* being called at a predictable time.
|
||||
* @access public
|
||||
*/
|
||||
function unsetTest() {
|
||||
$this->clear();
|
||||
$this->_test = NULL;
|
||||
}
|
||||
|
||||
//moodlefix ends
|
||||
/**
|
||||
* Accessor for currently running test case.
|
||||
* @return SimpleTestCase Current test.
|
||||
|
||||
@@ -148,6 +148,9 @@ class SimpleTestCase {
|
||||
$reporter->paintCaseEnd($this->getLabel());
|
||||
}
|
||||
unset($this->_reporter);
|
||||
//moodlefix begins
|
||||
$context->unsetTest();
|
||||
//moodlefix ends
|
||||
return $reporter->getStatus();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user