MDL-13154 Make it possible to unit test code that calls error() (2.0 only, PHP5 req)

This commit is contained in:
sam_marshall 2008-01-24 16:58:32 +00:00
parent 9d6c4e80f9
commit 8275580db3

View File

@ -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');