protected function 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:

See also

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

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

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/PHP.php, line 306

Class

PHPUnit_Util_PHP
Utility methods for PHP sub-processes.

Code

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