summaryrefslogtreecommitdiff
path: root/modules/gallery_unit_test/controllers/gallery_unit_test.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-03-04 15:11:26 -0800
committerBharat Mediratta <bharat@menalto.com>2013-03-04 15:11:26 -0800
commit20614e29c08ccdf704c93c83bb623dc55f2ef59e (patch)
treefcc05df4a51f1867a52940beec0b7044e7dfdad8 /modules/gallery_unit_test/controllers/gallery_unit_test.php
parente77276736351700b3bbd1080369738620ff8be28 (diff)
parentd5f3dfafda51a306ebe327b868931af1b0bbdb2a (diff)
Merge pull request #186 from jozefs/travis
Integrate with Travis CI
Diffstat (limited to 'modules/gallery_unit_test/controllers/gallery_unit_test.php')
-rw-r--r--modules/gallery_unit_test/controllers/gallery_unit_test.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php
index 67d006b3..55d0abc1 100644
--- a/modules/gallery_unit_test/controllers/gallery_unit_test.php
+++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php
@@ -27,6 +27,9 @@ class Gallery_Unit_Test_Controller extends Controller {
ini_set("display_errors", true);
error_reporting(-1);
+ // Track whether all tests pass so we can return an appropriate code to the CLI
+ $all_tests_passed = false;
+
// Jump through some hoops to satisfy the way that we check for the site_domain in
// config.php. We structure this such that the code in config will leave us with a
// site_domain of "." (for historical reasons)
@@ -132,7 +135,7 @@ class Gallery_Unit_Test_Controller extends Controller {
graphics::choose_default_toolkit();
$filter = count($_SERVER["argv"]) > 2 ? $_SERVER["argv"][2] : null;
- print new Unit_Test($modules, $filter);
+ print new Unit_Test($modules, $filter, $all_tests_passed);
} catch (ORM_Validation_Exception $e) {
print "Validation Exception: {$e->getMessage()}\n";
print $e->getTraceAsString() . "\n";
@@ -143,5 +146,11 @@ class Gallery_Unit_Test_Controller extends Controller {
print "Exception: {$e->getMessage()}\n";
print $e->getTraceAsString() . "\n";
}
+
+ // Let the CLI caller know whether all tests passed or not,
+ // to allow usage of continuous integration servers.
+ if (PHP_SAPI == 'cli') {
+ exit($all_tests_passed ? 0 : 1);
+ }
}
}