Follow-on fix: if tests throw an exception, don't throw another by calling an undefined variable.

This commit is contained in:
shadlaws
2013-03-10 11:27:10 +01:00
parent 4d631a4cad
commit b036b8acc0
@@ -145,9 +145,14 @@ class Gallery_Unit_Test_Controller extends Controller {
print $e->getTraceAsString() . "\n";
}
$failed = 0;
foreach ($unit_test->stats as $class => $stats) {
$failed += ($stats["failed"] + $stats["errors"]);
if (!isset($unit_test)) {
// If an exception is thrown, it's possible that $unit_test was never set.
$failed = 1;
} else {
$failed = 0;
foreach ($unit_test->stats as $class => $stats) {
$failed += ($stats["failed"] + $stats["errors"]);
}
}
if (PHP_SAPI == 'cli') {
exit($failed);