]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4137 moves test UI to developers plugin
authorCash Costello <cash.costello@gmail.com>
Sun, 1 Jan 2012 19:05:31 +0000 (14:05 -0500)
committerCash Costello <cash.costello@gmail.com>
Sun, 1 Jan 2012 19:05:31 +0000 (14:05 -0500)
mod/developers/languages/en.php
mod/developers/start.php
mod/developers/views/default/admin/develop_tools/unit_tests.php [new file with mode: 0644]
mod/diagnostics/languages/en.php
mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php

index a2682363cfa5a1bb2e5723689614a429828386f8..812f779fa15999860153e63614d56fa9c2ff619b 100644 (file)
@@ -9,6 +9,7 @@ $english = array(
        'admin:develop_tools' => 'Tools',
        'admin:develop_tools:preview' => 'Theming Sandbox',
        'admin:develop_tools:inspect' => 'Inspect',
+       'admin:develop_tools:unit_tests' => 'Unit Tests',
        'admin:developers' => 'Developers',
        'admin:developers:settings' => 'Settings',
 
@@ -54,6 +55,11 @@ $english = array(
        'theme_preview:navigation' => 'Navigation',
        'theme_preview:typography' => 'Typography',
 
+       // unit tests
+       'developers:unit_tests:description' => 'Elgg has unit and integration tests for detecting bugs in its core classes and functions.',
+       'developers:unit_tests:warning' => 'Warning: Do Not Run These Tests on a Production Site. They can corrupt your database.',
+       'developers:unit_tests:run' => 'Run',
+
        // status messages
        'developers:settings:success' => 'Settings saved',
 );
index 79ec0655a9490ca2644111b41788e7cf343f868d..d77a96b366371eac383544d69a6ee62ed9fce2d7 100644 (file)
@@ -63,6 +63,7 @@ function developers_setup_menu() {
        if (elgg_in_context('admin')) {
                elgg_register_admin_menu_item('develop', 'inspect', 'develop_tools');
                elgg_register_admin_menu_item('develop', 'preview', 'develop_tools');
+               elgg_register_admin_menu_item('develop', 'unit_tests', 'develop_tools');
 
                elgg_register_menu_item('page', array(
                        'name' => 'dev_settings',
@@ -76,8 +77,8 @@ function developers_setup_menu() {
 }
 
 /**
-* Clear all the strings so the raw descriptor strings are displayed
-*/
+ * Clear all the strings so the raw descriptor strings are displayed
+ */
 function developers_clear_strings() {
        global $CONFIG;
 
@@ -121,8 +122,8 @@ function developers_wrap_views($hook, $type, $result, $params) {
 }
 
 /**
-* Log the events and plugin hooks
-*/
+ * Log the events and plugin hooks
+ */
 function developers_log_events($name, $type) {
 
        // filter out some very common events
diff --git a/mod/developers/views/default/admin/develop_tools/unit_tests.php b/mod/developers/views/default/admin/develop_tools/unit_tests.php
new file mode 100644 (file)
index 0000000..81658e8
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Elgg unit and integration tests
+ * 
+ */
+
+echo '<p>' . elgg_echo('developers:unit_tests:description') . '</p>';
+echo '<p><strong>' . elgg_echo('developers:unit_tests:warning') . '</strong></p>';
+
+// create a button to run tests
+$params = array(
+       'text' => elgg_echo('developers:unit_tests:run'),
+       'href' => 'engine/tests/suite.php',
+       'class' => 'elgg-button elgg-button-submit',
+       'is_trusted' => true,
+);
+echo '<p>' . elgg_view('output/url', $params) . '</p>';
index c4e337b50e2b9fde4d44b672c0c14c7f704c2392..3619b2ee17bd92a32c51cf2b7c56fb3d763ce30f 100644 (file)
@@ -1,71 +1,45 @@
 <?php
-       /**
-        * Elgg diagnostics language pack.
-        *
-        * @package ElggDiagnostics
-        */
-
-       $english = array(
-
-                       'admin:develop_utilities:diagnostics' => 'System Diagnostics',
-                       'diagnostics' => 'System diagnostics',
-                       'diagnostics:report' => 'Diagnostics Report',
-                       '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 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.<br />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',
-
-
-                       'diagnostics:header' => '========================================================================
+/**
+ * Elgg diagnostics language pack.
+ *
+ * @package ElggDiagnostics
+ */
+
+$english = array(
+       'admin:develop_utilities:diagnostics' => 'System Diagnostics',
+       'diagnostics' => 'System diagnostics',
+       'diagnostics:report' => 'Diagnostics Report',
+       '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:download' => 'Download',
+       'diagnostics:header' => '========================================================================
 Elgg Diagnostic Report
 Generated %s by %s
 ========================================================================
 
 ',
-                       'diagnostics:report:basic' => '
+       'diagnostics:report:basic' => '
 Elgg Release %s, version %s
 
 ------------------------------------------------------------------------',
-                       'diagnostics:report:php' => '
+       'diagnostics:report:php' => '
 PHP info:
 %s
 ------------------------------------------------------------------------',
-                       'diagnostics:report:plugins' => '
+       'diagnostics:report:plugins' => '
 Installed plugins and details:
 
 %s
 ------------------------------------------------------------------------',
-                       'diagnostics:report:md5' => '
+       'diagnostics:report:md5' => '
 Installed files and checksums:
 
 %s
 ------------------------------------------------------------------------',
-                       'diagnostics:report:globals' => '
+       'diagnostics:report:globals' => '
 Global variables:
 
 %s
 ------------------------------------------------------------------------',
+);
 
-       );
-
-       add_translation("en",$english);
-?>
\ No newline at end of file
+add_translation("en", $english);
index 89e235279a30409e4a87afff1bf1ee4747515014..c7ff3d5fcd7cdc74f568cec73e9ff64ae6b6c28b 100644 (file)
@@ -14,25 +14,4 @@ $params = array(
 );
 $diagnostics .= '<p>' . elgg_view('output/url', $params) . '</p>';
 
-// unit tests
-$unit_tests_title = elgg_echo('diagnostics:unittester');
-$unit_tests .= '<p>' . elgg_echo('diagnostics:unittester:description') . '</p>';
-$unit_tests .= '<p>' . elgg_echo('diagnostics:unittester:warning') . '</p>';
-
-if (elgg_get_config('debug')) {
-       // create a button to run tests
-       $params = array(
-               'text' => elgg_echo('diagnostics:test:executeall'),
-               'href' => 'engine/tests/suite.php',
-               'class' => 'elgg-button elgg-button-submit',
-               'is_trusted' => true,
-       );
-       $unit_tests .= '<p>' . elgg_view('output/url', $params) . '</p>';
-} else {
-       // no tests when not in debug mode
-       $unit_tests .= elgg_echo('diagnostics:unittester:debug');
-}
-
-// display admin body
 echo elgg_view_module('inline', $diagnostics_title, $diagnostics, array('class' => 'elgg-form-settings'));
-echo elgg_view_module('inline', $unit_tests_title, $unit_tests, array('class' => 'elgg-form-settings'));