Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e044b17

Browse filesBrowse files
committed
Fix compatibility with symfony/security-core 6.x
1 parent d7019da commit e044b17
Copy full SHA for e044b17

File tree

2 files changed

+15
-2
lines changed
Filter options

2 files changed

+15
-2
lines changed

‎src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ public function loginUser(object $user, string $firewallContext = 'main'): self
123123
}
124124

125125
$token = new TestBrowserToken($user->getRoles(), $user, $firewallContext);
126-
$token->setAuthenticated(true);
126+
// @deprecated since Symfony 5.4
127+
if (method_exists($token, 'setAuthenticated')) {
128+
$token->setAuthenticated(true);
129+
}
127130

128131
$container = $this->getContainer();
129132
$container->get('security.untracked_token_storage')->setToken($token);

‎src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,12 @@ public function testForward()
138138
public function testGetUser()
139139
{
140140
$user = new InMemoryUser('user', 'pass');
141-
$token = new UsernamePasswordToken($user, 'pass', 'default', ['ROLE_USER']);
141+
if (method_exists(UsernamePasswordToken::class, 'setAuthenticated')) {
142+
// @deprecated since Symfony 5.4
143+
$token = new UsernamePasswordToken($user, 'pass', 'default', ['ROLE_USER']);
144+
} else {
145+
$token = new UsernamePasswordToken($user, 'default', ['ROLE_USER']);
146+
}
142147

143148
$controller = $this->createController();
144149
$controller->setContainer($this->getContainerWithTokenStorage($token));
@@ -148,6 +153,11 @@ public function testGetUser()
148153

149154
public function testGetUserAnonymousUserConvertedToNull()
150155
{
156+
// @deprecated since Symfony 5.4
157+
if (!class_exists(AnonymousToken::class)) {
158+
$this->markTestSkipped('This test requires "symfony/security-core" <6.0.');
159+
}
160+
151161
$token = new AnonymousToken('default', 'anon.');
152162

153163
$controller = $this->createController();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.