You are here

private function PHPUnit_Util_PHP::getException in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit/src/Util/PHP.php \PHPUnit_Util_PHP::getException()

Gets the thrown exception from a PHPUnit_Framework_TestFailure.

@since Method available since Release 3.6.0

Parameters

PHPUnit_Framework_TestFailure $error:

Return value

Exception

See also

https://github.com/sebastianbergmann/phpunit/issues/74

1 call to PHPUnit_Util_PHP::getException()
PHPUnit_Util_PHP::processChildResult in vendor/phpunit/phpunit/src/Util/PHP.php
Processes the TestResult object from an isolated process.

File

vendor/phpunit/phpunit/src/Util/PHP.php, line 192

Class

PHPUnit_Util_PHP
Utility methods for PHP sub-processes.

Code

private 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;
}