You are here

public function PartyBaseTestCase::errorHandler in Party 7

Extend the error handler to cope with E_USER_DEPRECATED if available.

Overrides DrupalTestCase::errorHandler

See also

http://drupal.org/node/2101235

File

tests/party.test, line 18
Tests for the Party module.

Class

PartyBaseTestCase
Base class for all Party 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',
    );
    if (defined('E_DEPRECATED')) {
      $error_map[E_DEPRECATED] = 'Run-time notice';
      $error_map[E_USER_DEPRECATED] = 'Run-time notice';
    }
    $backtrace = debug_backtrace();
    if (defined('E_USER_DEPRECATED') && $severity == E_USER_DEPRECATED) {
      array_shift($backtrace);
    }
    $this
      ->error($message, $error_map[$severity], _drupal_get_last_caller($backtrace));
  }
  return TRUE;
}