/** * Receives the callback from JError and logs the required error information for the test. * * @param JException $error The JException object from JError * * @return boolean To not continue with JError processing */ public static function errorCallback($error) { self::$actualError['code'] = $error->get('code'); self::$actualError['msg'] = $error->get('message'); self::$actualError['info'] = $error->get('info'); return false; }
/** * Dump the parameters and die * @return unknown_type */ function dumpDie() { if (!$this->_debug) { return; } $args = func_get_args(); echo '<pre>'; var_dump($args); echo '</pre>'; $ex = new JException('Stack'); echo '<pre>'; var_dump($ex->getTraceAsString()); echo '</pre>'; die; }
/** * Callback receives the error from JError and deals with it appropriately * If a test expects a JError to be raised, it should call this setExpectedError first * If you don't call this method first, the test will fail. * * @param JException $error The JException object from JError * * @return JException * * @deprecated 13.1 * @since 12.1 */ public function expectedErrorCallback($error) { foreach ($this->expectedErrors as $key => $err) { $thisError = true; foreach ($err as $prop => $value) { if ($error->get($prop) !== $value) { $thisError = false; } } if ($thisError) { unset($this->expectedErrors[$key]); return $error; } } $this->fail('An unexpected error occurred - ' . $error->get('message')); return $error; }
/** * Method to get the formatted backtrace information * * @final * @access public * @return string Formated string of trace * @since 1.5 */ function getTraceAsString() { //Get the trace array $trace = JException::getTrace(); $result = ''; foreach ($trace as $back) { if (isset($back['file']) && strpos($back['file'], 'error.php') === false) { $result .= '<br />' . $back['file'] . ':' . $back['line']; } } return $result; }