Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
project
drupal
Merge requests
!11414
Issue
#2699565
: Replace \Drupal:: with $this->container->get() in test classes of Basic Auth module
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#2699565
: Replace \Drupal:: with $this->container->get() in test classes of Basic Auth module
issue/drupal-2699565:11.x
into
11.x
Overview
5
Commits
7
Pipelines
7
Changes
4
4 unresolved threads
Hide all comments
Open
Alvaro Hurtado
requested to merge
issue/drupal-2699565:11.x
into
11.x
3 months ago
Overview
5
Commits
7
Pipelines
7
Changes
4
4 unresolved threads
Hide all comments
Expand
0
0
Merge request reports
Compare
11.x
version 6
dbeaafc6
1 month ago
version 5
fec6e5d2
2 months ago
version 4
cf654139
2 months ago
version 3
5b83a4ed
2 months ago
version 2
61ec403a
2 months ago
version 1
62103a63
3 months ago
11.x (HEAD)
and
latest version
latest version
700b90f0
7 commits,
1 month ago
version 6
dbeaafc6
6 commits,
1 month ago
version 5
fec6e5d2
5 commits,
2 months ago
version 4
cf654139
4 commits,
2 months ago
version 3
5b83a4ed
3 commits,
2 months ago
version 2
61ec403a
2 commits,
2 months ago
version 1
62103a63
1 commit,
3 months ago
4 files
+
26
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
core/modules/basic_auth/tests/modules/basic_auth_test/src/BasicAuthTestController.php
+
19
−
3
Options
@@ -4,16 +4,32 @@
namespace
Drupal\basic_auth_test
;
use
Drupal\Core\PageCache\ResponsePolicyInterface
;
use
Drupal\Core\State\StateInterface
;
/**
* Provides routes for HTTP Basic Authentication testing.
*/
class
BasicAuthTestController
{
/**
* Constructs a new BasicAuthTestController object.
*
* @param \Drupal\Core\State\StateInterface $state
* The state storage service.
* @param \Drupal\Core\PageCache\ResponsePolicy\ResponsePolicyInterface $pageCacheKillSwitch
* The page cache kill switch service.
*/
Comment on lines
+15
to
+22
A
Alex Pott
@alexpott
1 month ago
Maintainer
Suggested change
15
/**
16
* Constructs a new BasicAuthTestController object.
17
*
18
* @param \Drupal\Core\State\StateInterface $state
19
* The state storage service.
20
* @param \Drupal\Core\PageCache\ResponsePolicy\ResponsePolicyInterface $pageCacheKillSwitch
21
* The page cache kill switch service.
22
*/
Constructor documentation is no longer necessary.
Please
register
or
sign in
to reply
public
function
__construct
(
private
StateInterface
$state
,
private
ResponsePolicyInterface
$pageCacheKillSwitch
,
)
{}
/**
* @see \Drupal\basic_auth\Tests\Authentication\BasicAuthTest::testControllerNotCalledBeforeAuth()
*/
public
function
modifyState
()
{
\Drupal
::
state
()
->
set
(
'basic_auth_test.state.controller_executed'
,
TRUE
);
$this
->
state
->
set
(
'basic_auth_test.state.controller_executed'
,
TRUE
);
return
[
'#markup'
=>
'Done'
];
}
@@ -22,10 +38,10 @@ public function modifyState() {
*/
public
function
readState
()
{
// Mark this page as being uncacheable.
\Drupal
::
service
(
'
page
_c
ache
_k
ill
_s
witch
'
)
->
trigger
();
$this
->
page
C
ache
K
ill
S
witch
->
trigger
();
return
[
'#markup'
=>
\Drupal
::
state
()
->
get
(
'basic_auth_test.state.controller_executed'
)
?
'yep'
:
'nope'
,
'#markup'
=>
$this
->
state
->
get
(
'basic_auth_test.state.controller_executed'
)
?
'yep'
:
'nope'
,
'#cache'
=>
[
'max-age'
=>
0
,
],
Loading
Constructor documentation is no longer necessary.