mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-13154 Make it possible to unit test code that calls error() (2.0 only, PHP5 req)
This commit is contained in:
parent
9d6c4e80f9
commit
8275580db3
@ -5671,6 +5671,13 @@ function error ($message, $link='') {
|
||||
die;
|
||||
}
|
||||
|
||||
if (defined('UNITTEST')) {
|
||||
// Errors in unit test become exceptions, so you can unit test
|
||||
// code that might call error().
|
||||
throw new Exception('error() call: '.
|
||||
$message.($link!=='' ? ' ['.$link.']' : ''));
|
||||
}
|
||||
|
||||
if (! defined('HEADER_PRINTED')) {
|
||||
//header not yet printed
|
||||
@header('HTTP/1.0 404 Not Found');
|
||||
|
Loading…
x
Reference in New Issue
Block a user