Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
df6519aa
Commit
df6519aa
authored
Apr 29, 2015
by
Angie Byron
Browse files
Issue
#2479515
by znerol: Use BasicAuthTestTrait in BasicAuthTest
parent
bab62ec6
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php
View file @
df6519aa
...
...
@@ -9,6 +9,7 @@
use
Drupal\Component\Utility\SafeMarkup
;
use
Drupal\Core\Url
;
use
Drupal\basic_auth
\
Tests\BasicAuthTestTrait
;
use
Drupal\language\Entity\ConfigurableLanguage
;
use
Drupal\simpletest\WebTestBase
;
...
...
@@ -19,6 +20,8 @@
*/
class
BasicAuthTest
extends
WebTestBase
{
use
BasicAuthTestTrait
;
/**
* Modules installed for all tests.
*
...
...
@@ -177,41 +180,4 @@ function testUnauthorizedErrorMessage() {
$this
->
assertText
(
'Access denied'
,
"A user friendly access denied message is displayed"
);
}
/**
* Does HTTP basic auth request.
*
* We do not use \Drupal\simpletest\WebTestBase::drupalGet because we need to
* set curl settings for basic authentication.
*
* @param \Drupal\Core\Url|string $path
* Drupal path or URL to load into internal browser
* @param string $username
* The user name to authenticate with.
* @param string $password
* The password.
*
* @return string
* Curl output.
*/
protected
function
basicAuthGet
(
$path
,
$username
,
$password
)
{
if
(
$path
instanceof
Url
)
{
$path
=
$path
->
setAbsolute
()
->
toString
();
}
$out
=
$this
->
curlExec
(
array
(
CURLOPT_HTTPGET
=>
TRUE
,
CURLOPT_URL
=>
$path
,
CURLOPT_NOBODY
=>
FALSE
,
CURLOPT_HTTPAUTH
=>
CURLAUTH_BASIC
,
CURLOPT_USERPWD
=>
$username
.
':'
.
$password
,
)
);
$this
->
verbose
(
'GET request to: '
.
$path
.
'<hr />'
.
$out
);
return
$out
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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