diff options
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 11 | ||||
-rw-r--r-- | modules/simpletest/simpletest.install | 5 | ||||
-rw-r--r-- | modules/simpletest/simpletest.pages.inc | 25 |
3 files changed, 32 insertions, 9 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 19fe544c0..186195d28 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -415,8 +415,9 @@ abstract class DrupalTestCase { // HTTP auth settings (<username>:<password>) for the simpletest browser // when sending requests to the test site. - $username = variable_get('simpletest_username', NULL); - $password = variable_get('simpletest_password', NULL); + $this->httpauth_method = variable_get('simpletest_httpauth_method', CURLAUTH_BASIC); + $username = variable_get('simpletest_httpauth_username', NULL); + $password = variable_get('simpletest_httpauth_password', NULL); if ($username && $password) { $this->httpauth_credentials = $username . ':' . $password; } @@ -676,6 +677,11 @@ class DrupalWebTestCase extends DrupalTestCase { protected $originalUser = NULL; /** + * HTTP authentication method + */ + protected $httpauth_method = CURLAUTH_BASIC; + + /** * HTTP authentication credentials (<username>:<password>). */ protected $httpauth_credentials = NULL; @@ -1305,6 +1311,7 @@ class DrupalWebTestCase extends DrupalTestCase { CURLOPT_HEADERFUNCTION => array(&$this, 'curlHeaderCallback'), ); if (isset($this->httpauth_credentials)) { + $curl_options[CURLOPT_HTTPAUTH] = $this->httpauth_method; $curl_options[CURLOPT_USERPWD] = $this->httpauth_credentials; } curl_setopt_array($this->curlHandle, $this->additionalCurlOptions + $curl_options); diff --git a/modules/simpletest/simpletest.install b/modules/simpletest/simpletest.install index 68eb57815..0aab17e1c 100644 --- a/modules/simpletest/simpletest.install +++ b/modules/simpletest/simpletest.install @@ -13,8 +13,9 @@ function simpletest_uninstall() { simpletest_clean_environment(); // Remove settings variables. - variable_del('simpletest_username'); - variable_del('simpletest_password'); + variable_del('simpletest_httpauth_method'); + variable_del('simpletest_httpauth_username'); + variable_del('simpletest_httpauth_password'); variable_del('simpletest_clear_results'); variable_del('simpletest_verbose'); diff --git a/modules/simpletest/simpletest.pages.inc b/modules/simpletest/simpletest.pages.inc index bd3f471d3..846a44f41 100644 --- a/modules/simpletest/simpletest.pages.inc +++ b/modules/simpletest/simpletest.pages.inc @@ -442,18 +442,33 @@ function simpletest_settings_form($form, &$form_state) { $form['httpauth'] = array( '#type' => 'fieldset', - '#title' => t('HTTP authentication credentials'), + '#title' => t('HTTP authentication'), '#description' => t('HTTP auth settings to be used by the SimpleTest browser during testing. Useful when the site requires basic HTTP authentication.'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, ); - $form['httpauth']['simpletest_username'] = array( + $form['httpauth']['simpletest_httpauth_method'] = array( + '#type' => 'select', + '#title' => t('Method'), + '#options' => array( + CURLAUTH_BASIC => t('Basic'), + CURLAUTH_DIGEST => t('Digest'), + CURLAUTH_GSSNEGOTIATE => t('GSS negotiate'), + CURLAUTH_NTLM => t('NTLM'), + CURLAUTH_ANY => t('Any'), + CURLAUTH_ANYSAFE => t('Any safe'), + ), + '#default_value' => variable_get('simpletest_httpauth_method', CURLAUTH_BASIC), + ); + $form['httpauth']['simpletest_httpauth_username'] = array( '#type' => 'textfield', '#title' => t('Username'), - '#default_value' => variable_get('simpletest_username', ''), + '#default_value' => variable_get('simpletest_httpauth_username', ''), ); - $form['httpauth']['simpletest_password'] = array( + $form['httpauth']['simpletest_httpauth_password'] = array( '#type' => 'textfield', '#title' => t('Password'), - '#default_value' => variable_get('simpletest_password', ''), + '#default_value' => variable_get('simpletest_httpauth_password', ''), ); return system_settings_form($form); |