add_error_data() protected static method

adds error data to the main $errors var property and the current test's error array
See also: FUnit::$errors
See also: FUnit::error_handler()
See also: FUnit::exception_handler()
protected static add_error_data ( array $edata )
$edata array ['datetime', 'num', 'type', 'msg', 'file', 'line']
コード例 #1
0
ファイル: FUnit.php プロジェクト: funkatron/funit
 /**
  * custom error handler to catch errors triggered while running tests. this is
  * registered at the start of FUnit::run() and deregistered at stop
  * @see FUnit::run()
  * @internal
  */
 public static function error_handler($num, $msg, $file, $line, $vars)
 {
     $datetime = date("Y-m-d H:i:s (T)");
     $types = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
     $type = $types[$num];
     $bt_raw = debug_backtrace();
     array_shift($bt_raw);
     $backtrace = static::parse_backtrace($bt_raw);
     $edata = compact('datetime', 'num', 'type', 'msg', 'file', 'line', 'backtrace');
     FUnit::add_error_data($edata);
 }