From ccb5a69319a6a367988534296c678c8abf322879 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 17 Feb 2010 15:32:23 +0000 Subject: Fixes #1526: Big honking warning added to unit tests. Getter test also deletes its subtypes now. git-svn-id: http://code.elgg.org/elgg/trunk@3945 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/diagnostics/index.php | 17 ++++++--- mod/diagnostics/languages/en.php | 31 ++++++++-------- mod/diagnostics/start.php | 27 +------------- mod/diagnostics/testreport.php | 43 ---------------------- mod/diagnostics/unittester.php | 41 --------------------- mod/diagnostics/views/default/diagnostics/test.php | 27 -------------- .../views/default/diagnostics/testresult.php | 40 -------------------- 7 files changed, 29 insertions(+), 197 deletions(-) delete mode 100644 mod/diagnostics/testreport.php delete mode 100644 mod/diagnostics/unittester.php delete mode 100644 mod/diagnostics/views/default/diagnostics/test.php delete mode 100644 mod/diagnostics/views/default/diagnostics/testresult.php (limited to 'mod/diagnostics') diff --git a/mod/diagnostics/index.php b/mod/diagnostics/index.php index 9a7b66191..0cae3743c 100644 --- a/mod/diagnostics/index.php +++ b/mod/diagnostics/index.php @@ -1,7 +1,7 @@ +$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')); + +$test_body = '

' . elgg_echo('diagnostics:unittester:description') . '

'; +$test_body .= '

' . elgg_echo('diagnostics:unittester:warning') . '

'; + 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); + $test_body .= elgg_view('input/button', $params); } else { // no tests when not in debug mode - $button = elgg_echo('diagnostics:unittester:debug'); + $test_body .= elgg_echo('diagnostics:unittester:debug'); } -$body .= elgg_view('page_elements/contentwrapper', array('body' => - elgg_echo('diagnostics:unittester:description') . "
$button") + +$body .= elgg_view('page_elements/contentwrapper', array( + 'body' => $test_body) ); // create page diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php index 2562c10b8..ae72564d7 100644 --- a/mod/diagnostics/languages/en.php +++ b/mod/diagnostics/languages/en.php @@ -1,44 +1,45 @@ 'System diagnostics', '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:description' => 'Unit tests check Elgg Core for broken or buggy APIs.', 'diagnostics:unittester:debug' => 'The site must be in debug mode to run unit tests.', - + 'diagnostics:unittester:warning' => 'WARNING: These tests can leave behind debugging objects in your database. DO NOT USE ON A PRODUCTION SITE!', + 'diagnostics:test:executetest' => 'Execute test', 'diagnostics:test:executeall' => 'Execute All', 'diagnostics:unittester:notests' => 'Sorry, there are no unit test modules currently installed.', 'diagnostics:unittester:testnotfound' => 'Sorry, the report could not be generated because that test was not found', - + 'diagnostics:unittester:testresult:nottestclass' => 'FAIL - Result not a test class', 'diagnostics:unittester:testresult:fail' => 'FAIL', 'diagnostics:unittester:testresult:success' => 'SUCCESS', - + 'diagnostics:unittest:example' => 'Example unit test, only available in debug mode.', - + 'diagnostics:unittester:report' => 'Test report for %s', - + 'diagnostics:download' => 'Download .txt', - - + + 'diagnostics:header' => '======================================================================== Elgg Diagnostic Report Generated %s by %s ======================================================================== - + ', 'diagnostics:report:basic' => ' Elgg Release %s, version %s @@ -63,8 +64,8 @@ Global variables: %s ------------------------------------------------------------------------', - + ); - + add_translation("en",$english); ?> \ No newline at end of file diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index 76676c6a4..f4d1ab2af 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -43,31 +43,8 @@ function diagnostics_page_handler($page) { global $CONFIG; - if (isset($page[0])) - { - switch ($page[0]) - { - case 'tests' : - if ((isset($page[1])) && ($page[1])) { - switch ($page[1]) - { - case 'all': break; - default: set_input('test_func', $page[1]); - } - - include($CONFIG->pluginspath . "diagnostics/testreport.php"); - } - else - include($CONFIG->pluginspath . "diagnostics/unittester.php"); - break; - default: include($CONFIG->pluginspath . "diagnostics/index.php"); - } - } - else - { - // only interested in one page for now - include($CONFIG->pluginspath . "diagnostics/index.php"); - } + // only interested in one page for now + include($CONFIG->pluginspath . "diagnostics/index.php"); } /** diff --git a/mod/diagnostics/testreport.php b/mod/diagnostics/testreport.php deleted file mode 100644 index 2068ec280..000000000 --- a/mod/diagnostics/testreport.php +++ /dev/null @@ -1,43 +0,0 @@ - - elgg_view('diagnostics/testresult', array('function' => $r['function'], 'result' => $r['result'])) - )); - } - else - $body = elgg_view('page_elements/contentwrapper', array('body' => - elgg_echo('diagnostics:unittester:testnotfound' ) - )); - - page_draw($title_txt, elgg_view_layout("two_column_left_sidebar", '', $title . $body)); -?> \ No newline at end of file diff --git a/mod/diagnostics/unittester.php b/mod/diagnostics/unittester.php deleted file mode 100644 index 8b1993041..000000000 --- a/mod/diagnostics/unittester.php +++ /dev/null @@ -1,41 +0,0 @@ - $desc) - $test_body .= elgg_view('diagnostics/test', array('function' => $func, 'description' => $desc)); - } - else - $test_body = elgg_echo('diagnostics:unittester:notests'); - - $body = elgg_view('page_elements/contentwrapper', array('body' => - elgg_echo('diagnostics:unittester:description') . - elgg_view('diagnostics/runalltests') - ) - ); - - $body .= elgg_view('page_elements/contentwrapper', array('body' => - $test_body ) - ); - - - page_draw(elgg_echo('diagnostics:unittester'),elgg_view_layout("two_column_left_sidebar", '', $title . $body)); -?> \ No newline at end of file diff --git a/mod/diagnostics/views/default/diagnostics/test.php b/mod/diagnostics/views/default/diagnostics/test.php deleted file mode 100644 index 7546e6024..000000000 --- a/mod/diagnostics/views/default/diagnostics/test.php +++ /dev/null @@ -1,27 +0,0 @@ - -
-
- -
-
- -
-
- 'execute', 'value' => elgg_echo('diagnostics:test:executetest'))); - - echo elgg_view('input/form', array('action' => $vars['url'] . "pg/diagnostics/tests/{$vars['function']}", 'body' => $form_body)); - ?> -
-
\ No newline at end of file diff --git a/mod/diagnostics/views/default/diagnostics/testresult.php b/mod/diagnostics/views/default/diagnostics/testresult.php deleted file mode 100644 index 8db769f1d..000000000 --- a/mod/diagnostics/views/default/diagnostics/testresult.php +++ /dev/null @@ -1,40 +0,0 @@ -isSuccess()) - $successmessage = elgg_echo('diagnostics:unittester:testresult:success'); - else - $successmessage = elgg_echo('diagnostics:unittester:testresult:fail'); - } -?> -
-
-
-

:

-
-
- getDetails(); ?> -
-
- getDebug(); ?> -
-
-
\ No newline at end of file -- cgit v1.2.3