aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/suite.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/tests/suite.php')
-rw-r--r--[-rwxr-xr-x]engine/tests/suite.php45
1 files changed, 26 insertions, 19 deletions
diff --git a/engine/tests/suite.php b/engine/tests/suite.php
index dbe88065a..4203bc5d6 100755..100644
--- a/engine/tests/suite.php
+++ b/engine/tests/suite.php
@@ -1,16 +1,16 @@
<?php
/**
* Runs unit tests.
- *
+ *
* @package Elgg
* @subpackage Test
- * @author Curverider Ltd
- * @link http://elgg.org/
*/
require_once(dirname( __FILE__ ) . '/../start.php');
+admin_gatekeeper();
+
$vendor_path = "$CONFIG->path/vendors/simpletest";
$test_path = "$CONFIG->path/engine/tests";
@@ -19,28 +19,35 @@ require_once("$vendor_path/mock_objects.php");
require_once("$vendor_path/reporter.php");
require_once("$test_path/elgg_unit_test.php");
+// turn off system log
+elgg_unregister_event_handler('all', 'all', 'system_log_listener');
+elgg_unregister_event_handler('log', 'systemlog', 'system_log_default_logger');
+
+// Disable maximum execution time.
+// Tests take a while...
+set_time_limit(0);
+
$suite = new TestSuite('Elgg Core Unit Tests');
// emit a hook to pull in all tests
-$test_files = trigger_plugin_hook('unit_test', 'system', null, array());
+$test_files = elgg_trigger_plugin_hook('unit_test', 'system', null, array());
foreach ($test_files as $file) {
$suite->addTestFile($file);
}
// Only run tests in debug mode.
-if ($CONFIG->debug > 0) {
- if (TextReporter::inCli()) {
- // In CLI error codes are returned.
- // 0 is success.
- elgg_set_ignore_access(TRUE);
- exit ($suite->Run(new TextReporter()) ? 0 : 1 );
- }
- // Ensure that only logged-in users can see this page
- admin_gatekeeper();
- $old = elgg_set_ignore_access(TRUE);
- $suite->Run(new HtmlReporter());
- elgg_set_ignore_access($old);
-} else {
- // @todo display an error?
- exit (1);
+if (!isset($CONFIG->debug)) {
+ exit ('The site must be in debug mode to run unit tests.');
}
+
+if (TextReporter::inCli()) {
+ // In CLI error codes are returned: 0 is success
+ elgg_set_ignore_access(TRUE);
+ exit ($suite->Run(new TextReporter()) ? 0 : 1 );
+}
+
+// Ensure that only logged-in users can see this page
+//admin_gatekeeper();
+$old = elgg_set_ignore_access(TRUE);
+$suite->Run(new HtmlReporter('utf-8'));
+elgg_set_ignore_access($old);