aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/diagnostics/index.php57
-rw-r--r--mod/diagnostics/languages/en.php5
2 files changed, 40 insertions, 22 deletions
diff --git a/mod/diagnostics/index.php b/mod/diagnostics/index.php
index 11f489475..e77d004a8 100644
--- a/mod/diagnostics/index.php
+++ b/mod/diagnostics/index.php
@@ -1,25 +1,40 @@
<?php
- /**
- * Elgg diagnostics
- *
- * @package ElggDiagnostics
- * @author Curverider Ltd
- * @link http://elgg.com/
- */
+/**
+ * Elgg diagnostics
+ *
+ * @package ElggDiagnostics
+ * @author Curverider Ltd
+ * @link http://elgg.com/
+ */
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- admin_gatekeeper();
- set_context('admin');
- // Set admin user for user block
- set_page_owner($_SESSION['guid']);
+admin_gatekeeper();
+set_context('admin');
- $title = elgg_view_title(elgg_echo('diagnostics'));
-
- $body = elgg_view('page_elements/contentwrapper', array('body' =>
- elgg_echo('diagnostics:description') . elgg_view('diagnostics/forms/download'))
- );
-
-
- page_draw(elgg_echo('diagnostics'),elgg_view_layout("two_column_left_sidebar", '', $title . $body));
-?> \ No newline at end of file
+// Set admin user for user block
+set_page_owner($_SESSION['guid']);
+
+// system diagnostics
+$body = elgg_view_title(elgg_echo('diagnostics'));
+$body .= elgg_view('page_elements/contentwrapper', array('body' =>
+ elgg_echo('diagnostics:description') . elgg_view('diagnostics/forms/download'))
+);
+
+// unit tests
+$body .= elgg_view_title(elgg_echo('diagnostics:unittester'));
+if (isset($CONFIG->debug)) {
+ // create a button to run tests
+ $js = "onclick=\"window.location='{$CONFIG->wwwroot}engine/tests/suite.php'\"";
+ $params = array('type' => 'button', 'value' => elgg_echo('diagnostics:test:executeall'), 'js' => $js);
+ $button = elgg_view('input/button', $params);
+} else {
+ // no tests when not in debug mode
+ $button = elgg_echo('diagnostics:unittester:debug');
+}
+$body .= elgg_view('page_elements/contentwrapper', array('body' =>
+ elgg_echo('diagnostics:unittester:description') . "<br />$button")
+);
+
+// create page
+page_draw(elgg_echo('diagnostics'), elgg_view_layout("two_column_left_sidebar", '', $body));
diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php
index 94d3fb995..2562c10b8 100644
--- a/mod/diagnostics/languages/en.php
+++ b/mod/diagnostics/languages/en.php
@@ -10,10 +10,13 @@
$english = array(
'diagnostics' => 'System diagnostics',
- 'diagnostics:unittester' => 'Unit tests',
+ 'diagnostics:unittester' => 'Unit Tests',
'diagnostics:description' => 'The following diagnostic report is useful for diagnosing any problems with Elgg, and should be attached to any bug reports you file.',
'diagnostics:unittester:description' => 'The following are diagnostic tests which are registered by plugins and may be performed in order to debug parts of the Elgg framework.',
+
+ 'diagnostics:unittester:description' => 'Unit tests are useful to detect errors introduced by new plugins or modifications to Elgg.',
+ 'diagnostics:unittester:debug' => 'The site must be in debug mode to run unit tests.',
'diagnostics:test:executetest' => 'Execute test',
'diagnostics:test:executeall' => 'Execute All',