Skip to content

Commit 6c8513a

Browse files
committed
Merge branch '5.3' into 5.4
* 5.3: Fix compatibility with symfony/security-core 6.x
2 parents ea88d80 + 3fe93d6 commit 6c8513a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ public function loginUser(object $user, string $firewallContext = 'main'): self
126126

127127
$token = new TestBrowserToken($user->getRoles(), $user, $firewallContext);
128128
// @deprecated since Symfony 5.4
129-
if (method_exists($token, 'isAuthenticated')) {
130-
$token->setAuthenticated(true, false);
129+
if (method_exists($token, 'setAuthenticated')) {
130+
$token->setAuthenticated(true);
131131
}
132132

133133
$container = $this->getContainer();

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

Lines 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, '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));
@@ -151,6 +156,11 @@ public function testGetUser()
151156
*/
152157
public function testGetUserAnonymousUserConvertedToNull()
153158
{
159+
// @deprecated since Symfony 5.4
160+
if (!class_exists(AnonymousToken::class)) {
161+
$this->markTestSkipped('This test requires "symfony/security-core" <6.0.');
162+
}
163+
154164
$token = new AnonymousToken('default', 'anon.');
155165

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

0 commit comments

Comments
 (0)