From 99b38e5d1bde9654418416f1bb5675c4b3bec6ed Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 13 May 2009 16:13:40 +0000 Subject: Closes #1009: Diagnostics unit test with example git-svn-id: https://code.elgg.org/elgg/trunk@3287 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/diagnostics/languages/en.php | 4 +++- mod/diagnostics/start.php | 16 ++++++++++++++++ mod/diagnostics/views/default/diagnostics/test.php | 2 +- mod/diagnostics/views/default/diagnostics/testresult.php | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) (limited to 'mod/diagnostics') diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php index 5d19824bd..df6ffdf73 100644 --- a/mod/diagnostics/languages/en.php +++ b/mod/diagnostics/languages/en.php @@ -24,7 +24,9 @@ 'diagnostics:unittester:testresult:nottestclass' => 'FAIL - Result not a test class', 'diagnostics:unittester:testresult:fail' => 'FAIL', - 'diagnostics:unittester:testresult:success' => 'FAIL', + 'diagnostics:unittester:testresult:success' => 'SUCCESS', + + 'diagnostics:unittest:example' => 'Example unit test, only available in debug mode.', 'diagnostics:unittester:report' => 'Test report for %s', diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index a7afe346e..de8e09468 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -22,6 +22,12 @@ // Register some actions register_action("diagnostics/download",false, $CONFIG->pluginspath . "diagnostics/actions/download.php"); + + // If debug on then enable an example test + if ((isset($CONFIG->debug)) && ($CONFIG->debug)) + { + register_elgg_test(elgg_echo('diagnostics:unittest:example'), 'diagnostics_test_test'); + } } /** @@ -37,6 +43,16 @@ } } + function diagnostics_test_test() + { + ob_start(); + + for ($n = 0; $n<5; $n++) + echo "$n "; + + return ElggTestResult::CreateSuccessResult(ob_get_clean()); + } + /** * Diagnostics page. * diff --git a/mod/diagnostics/views/default/diagnostics/test.php b/mod/diagnostics/views/default/diagnostics/test.php index 5010eb903..9edfb4c66 100644 --- a/mod/diagnostics/views/default/diagnostics/test.php +++ b/mod/diagnostics/views/default/diagnostics/test.php @@ -13,7 +13,7 @@ ?>
- +
diff --git a/mod/diagnostics/views/default/diagnostics/testresult.php b/mod/diagnostics/views/default/diagnostics/testresult.php index ddd688e93..ad43aadfb 100644 --- a/mod/diagnostics/views/default/diagnostics/testresult.php +++ b/mod/diagnostics/views/default/diagnostics/testresult.php @@ -30,7 +30,7 @@
-

:

+

:

getDetails(); ?> -- cgit v1.2.3