aboutsummaryrefslogtreecommitdiff
path: root/mod/diagnostics/views
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-05-13 15:59:22 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-05-13 15:59:22 +0000
commit3773f8d81c53dd0508325d6380ee49569951a61f (patch)
treec3ac0a4d080375bb325f140d0de66c33db703f80 /mod/diagnostics/views
parentcf07718b4e44cb2711380a0ceb37de1031a5d4a8 (diff)
downloadelgg-3773f8d81c53dd0508325d6380ee49569951a61f.tar.gz
elgg-3773f8d81c53dd0508325d6380ee49569951a61f.tar.bz2
Refs #1009: Enhancements to diagnostics tool to use the test framework.
git-svn-id: https://code.elgg.org/elgg/trunk@3286 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/diagnostics/views')
-rw-r--r--mod/diagnostics/views/default/diagnostics/runalltests.php15
-rw-r--r--mod/diagnostics/views/default/diagnostics/test.php29
-rw-r--r--mod/diagnostics/views/default/diagnostics/testresult.php42
3 files changed, 86 insertions, 0 deletions
diff --git a/mod/diagnostics/views/default/diagnostics/runalltests.php b/mod/diagnostics/views/default/diagnostics/runalltests.php
new file mode 100644
index 000000000..12bbf2a4a
--- /dev/null
+++ b/mod/diagnostics/views/default/diagnostics/runalltests.php
@@ -0,0 +1,15 @@
+<?php
+ /**
+ * Elgg diagnostics - unit tester
+ *
+ * @package ElggDiagnostics
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ */
+
+ $form_body .= elgg_view('input/submit', array('internalname' => 'execute', 'value' => elgg_echo('diagnostics:test:executeall')));
+
+ echo elgg_view('input/form', array('action' => $vars['url'] . "pg/diagnostics/tests/all", 'body' => $form_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
new file mode 100644
index 000000000..5010eb903
--- /dev/null
+++ b/mod/diagnostics/views/default/diagnostics/test.php
@@ -0,0 +1,29 @@
+<?php
+ /**
+ * Elgg diagnostics
+ *
+ * @package ElggDiagnostics
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ */
+
+
+?>
+<div class="test">
+ <div class="test_header">
+ <?php echo $vars['function']; ?>
+ </div>
+ <div class="test_description">
+ <?php echo $vars['description']; ?>
+ </div>
+ <div class="test_button">
+ <?php
+
+ $form_body = elgg_view('input/submit', array('internalname' => 'execute', 'value' => elgg_echo('diagnostics:test:executetest')));
+
+ echo elgg_view('input/form', array('action' => $vars['url'] . "pg/diagnostics/tests/{$vars['function']}", 'body' => $form_body));
+ ?>
+ </div>
+</div> \ No newline at end of file
diff --git a/mod/diagnostics/views/default/diagnostics/testresult.php b/mod/diagnostics/views/default/diagnostics/testresult.php
new file mode 100644
index 000000000..ddd688e93
--- /dev/null
+++ b/mod/diagnostics/views/default/diagnostics/testresult.php
@@ -0,0 +1,42 @@
+<?php
+ /**
+ * Elgg diagnostics - test report
+ *
+ * @package ElggDiagnostics
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ */
+
+ $result = $vars['result'];
+
+ $testresult_div = 'fail';
+ $successmessage = "";
+
+ if (!($result instanceof ElggTestResult))
+ {
+ $successmessage = elgg_echo('diagnostics:unittester:testresult:nottestclass');
+ $result = ElggTestResult::CreateFailResult(elgg_echo('diagnostics:unittester:testresult:fail'));
+ }
+ else
+ {
+ if ($result->isSuccess())
+ $successmessage = elgg_echo('diagnostics:unittester:testresult:success');
+ else
+ $successmessage = elgg_echo('diagnostics:unittester:testresult:fail');
+ }
+?>
+<div class="testreport">
+ <div class="testreport_<?php echo $testresult_div; ?>">
+ <div class="testreport_header">
+ <p><?php echo $vars['function']; ?> : <?php echo $successmessage; ?></p>
+ </div>
+ <div class="testreport_details">
+ <?php echo $result->getDetails(); ?>
+ </div>
+ <div class="testreport_debug">
+ <?php echo $result->getDebug(); ?>
+ </div>
+ </div>
+</div> \ No newline at end of file