mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-17534 simpletest: temporary fix for exception problems
This commit is contained in:
parent
9d833e931c
commit
995821591d
@ -46,9 +46,20 @@ class SimpleErrorTrappingInvoker extends SimpleInvokerDecorator {
|
||||
function invoke($method) {
|
||||
$queue = &$this->_createErrorQueue();
|
||||
set_error_handler('SimpleTestErrorHandler');
|
||||
parent::invoke($method);
|
||||
//moodle hack start
|
||||
// note: this breaks PHP4 compatibility!
|
||||
$rethrow = null;
|
||||
try {
|
||||
parent::invoke($method);
|
||||
} catch (Exception $e) {
|
||||
$rethrow = $e;
|
||||
}
|
||||
restore_error_handler();
|
||||
$queue->tally();
|
||||
if ($rethrow) {
|
||||
throw $rethrow;
|
||||
}
|
||||
//moodle hack end
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,8 +65,19 @@ class SimpleInvoker {
|
||||
*/
|
||||
function invoke($method) {
|
||||
$this->_test_case->setUp();
|
||||
$this->_test_case->$method();
|
||||
// moodle hack start
|
||||
// note: this breaks PHP4 compatibility!
|
||||
$rethrow = null;
|
||||
try {
|
||||
$this->_test_case->$method();
|
||||
} catch (Exception $e) {
|
||||
$rethrow = $e;
|
||||
}
|
||||
$this->_test_case->tearDown();
|
||||
if ($rethrow) {
|
||||
throw $rethrow;
|
||||
}
|
||||
// moodle hack end
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@ Description of Simpletest 1.0.1beta library import into Moodle
|
||||
|
||||
Changes:
|
||||
* test_case.php - added our global $CFG before include() MDL-10064
|
||||
* fixed exception support (MDL-17534) - try/catch in invoker.php and errors.php
|
||||
|
||||
skodak
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user