Gets the thrown exception from a PHPUnit_Framework_TestFailure.
@since Method available since Release 3.6.0
PHPUnit_Framework_TestFailure $error:
https://github.com/sebastianbergmann/phpunit/issues/74
protected function getException(PHPUnit_Framework_TestFailure $error) {
$exception = $error
->thrownException();
if ($exception instanceof __PHP_Incomplete_Class) {
$exceptionArray = array();
foreach ((array) $exception as $key => $value) {
$key = substr($key, strrpos($key, "\0") + 1);
$exceptionArray[$key] = $value;
}
$exception = new PHPUnit_Framework_SyntheticError(sprintf('%s: %s', $exceptionArray['_PHP_Incomplete_Class_Name'], $exceptionArray['message']), $exceptionArray['code'], $exceptionArray['file'], $exceptionArray['line'], $exceptionArray['trace']);
}
return $exception;
}