summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-07-07 08:07:24 +0000
committerDries Buytaert <dries@buytaert.net>2009-07-07 08:07:24 +0000
commitb7f34acb6cd14f90358d92095538631fbd740cee (patch)
tree46abac385ce813e3d6ab7d62f95fe560857b1cba
parent129a20f1555d3d8afe6d2dbfb37faace087dbbec (diff)
downloadbrdo-b7f34acb6cd14f90358d92095538631fbd740cee.tar.gz
brdo-b7f34acb6cd14f90358d92095538631fbd740cee.tar.bz2
- Patch #500292 by Boombatower: provide a settings pagea for hidden SimpleTest variables.
-rw-r--r--modules/simpletest/drupal_web_test_case.php6
-rw-r--r--modules/simpletest/simpletest.module11
-rw-r--r--modules/simpletest/simpletest.pages.inc36
3 files changed, 52 insertions, 1 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index e48765334..e78c4ce50 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -378,7 +378,11 @@ abstract class DrupalTestCase {
public function run() {
// HTTP auth settings (<username>:<password>) for the simpletest browser
// when sending requests to the test site.
- $this->httpauth_credentials = variable_get('simpletest_httpauth_credentials', NULL);
+ $username = variable_get('simpletest_username', NULL);
+ $password = variable_get('simpletest_password', NULL);
+ if ($username && $password) {
+ $this->httpauth_credentials = $username . ':' . $password;
+ }
set_error_handler(array($this, 'errorHandler'));
$methods = array();
diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module
index e1bf2c45f..ae5fe60ab 100644
--- a/modules/simpletest/simpletest.module
+++ b/modules/simpletest/simpletest.module
@@ -32,6 +32,17 @@ function simpletest_menu() {
'description' => 'Run tests against Drupal core and your active modules. These tests help assure that your site code is working as designed.',
'access arguments' => array('administer unit tests'),
);
+ $items['admin/development/testing/list'] = array(
+ 'title' => 'List',
+ 'type' => MENU_DEFAULT_LOCAL_TASK,
+ );
+ $items['admin/development/testing/settings'] = array(
+ 'title' => 'Settings',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('simpletest_settings_form'),
+ 'access arguments' => array('administer unit tests'),
+ 'type' => MENU_LOCAL_TASK,
+ );
$items['admin/development/testing/results/%'] = array(
'title' => 'Test result',
'page callback' => 'drupal_get_form',
diff --git a/modules/simpletest/simpletest.pages.inc b/modules/simpletest/simpletest.pages.inc
index 34b111862..44a02d037 100644
--- a/modules/simpletest/simpletest.pages.inc
+++ b/modules/simpletest/simpletest.pages.inc
@@ -404,3 +404,39 @@ function simpletest_result_status_image($status) {
}
return FALSE;
}
+
+/**
+ * Provides settings form for SimpleTest variables.
+ */
+function simpletest_settings_form(&$form_state) {
+ $form = array();
+
+ $form['general'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('General'),
+ );
+ $form['general']['simpletest_clear_results'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Clear results'),
+ '#description' => t('Clear the test results after each complete test suite run. By default SimpleTest will clear the results after they have been viewed on the results page, but in some cases it may be useful to leave the results in the database. The results can then be viewed at <em>admin/development/testing/[test_id]</em>. The test ID can be found in the database, simpletest table, or kept track of when viewing the results the first time. Additionally, some modules may provide more analaysis or features that require this setting to be disabled.'),
+ '#default_value' => variable_get('simpletest_clear_results', TRUE),
+ );
+
+ $form['httpauth'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('HTTP authentication credentials'),
+ '#description' => t('HTTP auth settings to be used by the SimpleTest browser during testing. Useful when the site requires basic HTTP authentication.'),
+ );
+ $form['httpauth']['simpletest_username'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Username'),
+ '#default_value' => variable_get('simpletest_username', ''),
+ );
+ $form['httpauth']['simpletest_password'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Password'),
+ '#default_value' => variable_get('simpletest_password', ''),
+ );
+
+ return system_settings_form($form);
+}