summaryrefslogtreecommitdiff
path: root/modules/gallery_unit_test
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-03-11 09:29:51 -0700
committerBharat Mediratta <bharat@menalto.com>2013-03-11 09:29:51 -0700
commit1a9f87d3eefe1fe2d327d7e1ac7628c78314d2eb (patch)
treef4e5c40073d6582941b648c3ac8b622478afafb2 /modules/gallery_unit_test
parent4d631a4cad515984fd202fbaa124b6a01f156379 (diff)
parentb036b8acc0835126e76814abdd76da4d80d4b0fc (diff)
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.
Diffstat (limited to 'modules/gallery_unit_test')
-rw-r--r--modules/gallery_unit_test/controllers/gallery_unit_test.php11
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);