function DrupalTestCase::errorHandler
Handle errors during test runs.
Because this is registered in set_error_handler(), it has to be public.
See also
set_error_handler
1 call to DrupalTestCase::errorHandler()
- SystemValidTokenTest::errorHandler in modules/
system/ system.test - Overrides DrupalTestCase::errorHandler().
1 method overrides DrupalTestCase::errorHandler()
- SystemValidTokenTest::errorHandler in modules/
system/ system.test - Overrides DrupalTestCase::errorHandler().
File
-
modules/
simpletest/ drupal_web_test_case.php, line 592
Class
- DrupalTestCase
- Base class for Drupal tests.
Code
public function errorHandler($severity, $message, $file = NULL, $line = NULL) {
if ($severity & error_reporting()) {
$error_map = array(
E_STRICT => 'Run-time notice',
E_WARNING => 'Warning',
E_NOTICE => 'Notice',
E_CORE_ERROR => 'Core error',
E_CORE_WARNING => 'Core warning',
E_USER_ERROR => 'User error',
E_USER_WARNING => 'User warning',
E_USER_NOTICE => 'User notice',
E_RECOVERABLE_ERROR => 'Recoverable error',
);
// PHP 5.3 adds new error logging constants. Add these conditionally for
// backwards compatibility with PHP 5.2.
if (defined('E_DEPRECATED')) {
$error_map += array(
E_DEPRECATED => 'Deprecated',
E_USER_DEPRECATED => 'User deprecated',
);
}
$backtrace = debug_backtrace();
$this->error($message, $error_map[$severity], _drupal_get_last_caller($backtrace));
}
return TRUE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.