mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-37919-phpunit-exception' of git://github.com/mudrd8mz/moodle
This commit is contained in:
commit
ef1a4d20d4
1 changed files with 9 additions and 0 deletions
|
@ -137,14 +137,23 @@ class moodle_exception extends Exception {
|
|||
|
||||
if (get_string_manager()->string_exists($errorcode, $module)) {
|
||||
$message = get_string($errorcode, $module, $a);
|
||||
$haserrorstring = true;
|
||||
} else {
|
||||
$message = $module . '/' . $errorcode;
|
||||
$haserrorstring = false;
|
||||
}
|
||||
|
||||
if (defined('PHPUNIT_TEST') and PHPUNIT_TEST and $debuginfo) {
|
||||
$message = "$message ($debuginfo)";
|
||||
}
|
||||
|
||||
if (!$haserrorstring and defined('PHPUNIT_TEST') and PHPUNIT_TEST) {
|
||||
// Append the contents of $a to $debuginfo so helpful information isn't lost.
|
||||
// This emulates what {@link get_exception_info()} does. Unfortunately that
|
||||
// function is not used by phpunit.
|
||||
$message .= PHP_EOL.'$a contents: '.print_r($a, true);
|
||||
}
|
||||
|
||||
parent::__construct($message, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue