Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
6b81f43e
Commit
6b81f43e
authored
Dec 30, 2009
by
Dries
Browse files
- Patch
#669456
by boombatower: added support for more HTTP authentication settings in the tests.
parent
949ccddb
Changes
3
Hide whitespace changes
Inline
Side-by-side
modules/simpletest/drupal_web_test_case.php
View file @
6b81f43e
...
...
@@ -415,8 +415,9 @@ public function run() {
// 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
;
}
...
...
@@ -675,6 +676,11 @@ class DrupalWebTestCase extends DrupalTestCase {
*/
protected
$originalUser
=
NULL
;
/**
* HTTP authentication method
*/
protected
$httpauth_method
=
CURLAUTH_BASIC
;
/**
* HTTP authentication credentials (<username>:<password>).
*/
...
...
@@ -1305,6 +1311,7 @@ protected function curlInitialize() {
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
);
...
...
modules/simpletest/simpletest.install
View file @
6b81f43e
...
...
@@ -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'
);
...
...
modules/simpletest/simpletest.pages.inc
View file @
6b81f43e
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment