Returns a description for an exception.
@since Method available since Release 3.2.0
Exception $e:
string
public static function exceptionToString(Exception $e) {
if ($e instanceof PHPUnit_Framework_SelfDescribing) {
$buffer = $e
->toString();
if ($e instanceof PHPUnit_Framework_ExpectationFailedException && $e
->getComparisonFailure()) {
$buffer = $buffer . "\n" . $e
->getComparisonFailure()
->getDiff();
}
if (!empty($buffer)) {
$buffer = trim($buffer) . "\n";
}
}
else {
if ($e instanceof PHPUnit_Framework_Error) {
$buffer = $e
->getMessage() . "\n";
}
else {
$buffer = get_class($e) . ': ' . $e
->getMessage() . "\n";
}
}
return $buffer;
}