Skip to content

Commit a15310f

Browse files
author
Rasmus Schultz
committed
catch Error under PHP 7
1 parent d9a8038 commit a15310f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/TestDriver.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace mindplay\testies;
44

5+
use Error;
56
use PHP_CodeCoverage;
67
use PHP_CodeCoverage_Report_Text;
78
use PHP_CodeCoverage_Report_Clover;
@@ -155,6 +156,10 @@ public function run()
155156
} catch (Exception $e) {
156157
$this->printResult(false, "UNEXPECTED EXCEPTION", $e);
157158

159+
$thrown = $e;
160+
} catch (Error $e) {
161+
$this->printResult(false, "UNEXPECTED EXCEPTION", $e);
162+
158163
$thrown = $e;
159164
}
160165

@@ -270,7 +275,7 @@ public function printSummary()
270275
*/
271276
public function format($value, $detailed = false)
272277
{
273-
if ($value instanceof Exception) {
278+
if ($value instanceof Exception || $value instanceof Error) {
274279
return $detailed
275280
? get_class($value) . ": \n\"" . $value->getMessage() . "\"\n\nStacktrace:\n" . $value->getTraceAsString()
276281
: get_class($value) . ": \n\"" . $value->getMessage() . "\"";

0 commit comments

Comments
 (0)