mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-22 07:43:53 -04:00
Follow-on fix: if tests throw an exception, don't throw another by calling an undefined variable.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user