Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443205
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443205
Commits
df6519aa
Commit
df6519aa
authored
9 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2479515
by znerol: Use BasicAuthTestTrait in BasicAuthTest
parent
bab62ec6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php
+3
-37
3 additions, 37 deletions
...les/basic_auth/src/Tests/Authentication/BasicAuthTest.php
with
3 additions
and
37 deletions
core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php
+
3
−
37
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
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment