From 282fc81a72825a1efbb5b72b4ba127865bfd28cf Mon Sep 17 00:00:00 2001 From: nickw Date: Thu, 22 Oct 2009 14:57:08 +0000 Subject: Adding unit testing to the GUI. Unit tests can be run from the core Diagnostics mod. git-svn-id: http://code.elgg.org/elgg/trunk@3570 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/diagnostics/index.php | 57 +++++++++++++++++++++++++--------------- mod/diagnostics/languages/en.php | 5 +++- 2 files changed, 40 insertions(+), 22 deletions(-) (limited to 'mod') 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 @@ - 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') . "
$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', -- cgit v1.2.3