diff options
author | nickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-22 14:57:08 +0000 |
---|---|---|
committer | nickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-22 14:57:08 +0000 |
commit | 282fc81a72825a1efbb5b72b4ba127865bfd28cf (patch) | |
tree | 697d8230364ac61b34e5c3dbc8e7e7d717d7236c /mod/diagnostics/index.php | |
parent | ae4e90dcd604d2b9741d251c8225494d7aedd615 (diff) | |
download | elgg-282fc81a72825a1efbb5b72b4ba127865bfd28cf.tar.gz elgg-282fc81a72825a1efbb5b72b4ba127865bfd28cf.tar.bz2 |
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
Diffstat (limited to 'mod/diagnostics/index.php')
-rw-r--r-- | mod/diagnostics/index.php | 57 |
1 files changed, 36 insertions, 21 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)); |