Merge pull request #199 from shadlaws/unit_test_fix_20130310

Follow-on fix: if tests throw an exception, don't throw another by calling an undefined variable.
This commit is contained in:
Bharat Mediratta
2013-03-11 09:29:51 -07:00
@@ -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);