lithium\test\Unit::_reportException()

protected method

Convert an exception object to an exception result array for test reporting.

Parameters

  • array $exception

    The exception data to report on. Statistics are gathered and added to the reporting stack contained in Unit::$_results.

  • string $lineFlag

Returns

void

Source

	protected function _reportException($exception, $lineFlag = null) {
		$message = $exception['message'];
		$initFrame = current($exception['trace']) + ['class' => '-', 'function' => '-'];

		foreach ($exception['trace'] as $frame) {
			if (isset($scopedFrame)) {
				break;
			}
			if (!class_exists('lithium\analysis\Inspector')) {
				continue;
			}
			if (isset($frame['class']) && in_array($frame['class'], Inspector::parents($this))) {
				$scopedFrame = $frame;
			}
		}
		if (class_exists('lithium\analysis\Debugger')) {
			$exception['trace'] = Debugger::trace([
				'trace'        => $exception['trace'],
				'format'       => '{:functionRef}, line {:line}',
				'includeScope' => false,
				'scope'        => array_filter([
					'functionRef' => __NAMESPACE__ . '\{closure}',
					'line'        => $lineFlag
				])
			]);
		}
		$this->_result('exception', $exception + [
			'class'     => $initFrame['class'],
			'method'    => $initFrame['function']
		]);
	}