diff options
author | shadlaws <shad@shadlaws.com> | 2013-03-10 11:27:10 +0100 |
---|---|---|
committer | shadlaws <shad@shadlaws.com> | 2013-03-10 11:27:10 +0100 |
commit | b036b8acc0835126e76814abdd76da4d80d4b0fc (patch) | |
tree | f4e5c40073d6582941b648c3ac8b622478afafb2 /modules | |
parent | 4d631a4cad515984fd202fbaa124b6a01f156379 (diff) |
Follow-on fix: if tests throw an exception, don't throw another by calling an undefined variable.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery_unit_test/controllers/gallery_unit_test.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php index 3275d741..6b2bf479 100644 --- a/modules/gallery_unit_test/controllers/gallery_unit_test.php +++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php @@ -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); |