aboutsummaryrefslogtreecommitdiff
path: root/mod/diagnostics
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-05-13 16:13:40 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-05-13 16:13:40 +0000
commit99b38e5d1bde9654418416f1bb5675c4b3bec6ed (patch)
treebad1aa9e98103711e9700ac6e3d1c317e9688c73 /mod/diagnostics
parent3773f8d81c53dd0508325d6380ee49569951a61f (diff)
downloadelgg-99b38e5d1bde9654418416f1bb5675c4b3bec6ed.tar.gz
elgg-99b38e5d1bde9654418416f1bb5675c4b3bec6ed.tar.bz2
Closes #1009: Diagnostics unit test with example
git-svn-id: https://code.elgg.org/elgg/trunk@3287 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/diagnostics')
-rw-r--r--mod/diagnostics/languages/en.php4
-rw-r--r--mod/diagnostics/start.php16
-rw-r--r--mod/diagnostics/views/default/diagnostics/test.php2
-rw-r--r--mod/diagnostics/views/default/diagnostics/testresult.php2
4 files changed, 21 insertions, 3 deletions
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 @@
?>
<div class="test">
<div class="test_header">
- <?php echo $vars['function']; ?>
+ <b><?php echo $vars['function']; ?></b>
</div>
<div class="test_description">
<?php echo $vars['description']; ?>
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 @@
<div class="testreport">
<div class="testreport_<?php echo $testresult_div; ?>">
<div class="testreport_header">
- <p><?php echo $vars['function']; ?> : <?php echo $successmessage; ?></p>
+ <p><b><?php echo $vars['function']; ?> : </b><?php echo $successmessage; ?></p>
</div>
<div class="testreport_details">
<?php echo $result->getDetails(); ?>