Skip to content

Commit

Permalink
catch Error under PHP 7
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasmus Schultz committed May 6, 2016
1 parent d9a8038 commit a15310f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/TestDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace mindplay\testies;

use Error;
use PHP_CodeCoverage;
use PHP_CodeCoverage_Report_Text;
use PHP_CodeCoverage_Report_Clover;
Expand Down Expand Up @@ -155,6 +156,10 @@ public function run()
} catch (Exception $e) {
$this->printResult(false, "UNEXPECTED EXCEPTION", $e);

$thrown = $e;
} catch (Error $e) {
$this->printResult(false, "UNEXPECTED EXCEPTION", $e);

$thrown = $e;
}

Expand Down Expand Up @@ -270,7 +275,7 @@ public function printSummary()
*/
public function format($value, $detailed = false)
{
if ($value instanceof Exception) {
if ($value instanceof Exception || $value instanceof Error) {
return $detailed
? get_class($value) . ": \n\"" . $value->getMessage() . "\"\n\nStacktrace:\n" . $value->getTraceAsString()
: get_class($value) . ": \n\"" . $value->getMessage() . "\"";
Expand Down

0 comments on commit a15310f

Please sign in to comment.