-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Fix compatibility with symfony/security-core 6.x (deps=high tests) #44427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,7 +138,12 @@ public function testForward() | |
public function testGetUser() | ||
{ | ||
$user = new InMemoryUser('user', 'pass'); | ||
$token = new UsernamePasswordToken($user, 'pass', 'default', ['ROLE_USER']); | ||
if (method_exists(UsernamePasswordToken::class, 'setAuthenticated')) { | ||
// @deprecated since Symfony 5.4 | ||
$token = new UsernamePasswordToken($user, 'pass', 'default', ['ROLE_USER']); | ||
} else { | ||
$token = new UsernamePasswordToken($user, 'default', ['ROLE_USER']); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected BC break, correct deprecations are triggered on 5.4. |
||
|
||
$controller = $this->createController(); | ||
$controller->setContainer($this->getContainerWithTokenStorage($token)); | ||
|
@@ -148,6 +153,11 @@ public function testGetUser() | |
|
||
public function testGetUserAnonymousUserConvertedToNull() | ||
{ | ||
// @deprecated since Symfony 5.4 | ||
if (!class_exists(AnonymousToken::class)) { | ||
$this->markTestSkipped('This test requires "symfony/security-core" <6.0.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is irrelevant in 6.0, as anonymous tokens are removed and anonymous sessions are now null anyways (so no conversion is needed in |
||
} | ||
|
||
$token = new AnonymousToken('default', 'anon.'); | ||
|
||
$controller = $this->createController(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The real bugfix of this PR, this adds support for security-core 6.0 in FrameworkBundle.