File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 2626use Symfony \Component \Security \Core \Exception \AuthenticationException ;
2727use Symfony \Component \Security \Core \Security as DeprecatedSecurity ;
2828use Symfony \Component \Security \Http \Authentication \AuthenticationUtils ;
29+ use Symfony \Component \Security \Http \SecurityRequestAttributes ;
2930use Twig \Environment ;
3031
3132final class LoginControllerTest extends TestCase
@@ -211,6 +212,12 @@ private function createController(): LoginController
211212
212213 private function getSecurityErrorKey (): string
213214 {
215+ // Symfony 6.4+ compatibility
216+ if (class_exists (SecurityRequestAttributes::class)) {
217+ return SecurityRequestAttributes::AUTHENTICATION_ERROR ;
218+ }
219+
220+ // Symfony 5.4 & <6.4 compatibility
214221 return class_exists (Security::class) ? Security::AUTHENTICATION_ERROR : DeprecatedSecurity::AUTHENTICATION_ERROR ;
215222 }
216223}
Original file line number Diff line number Diff line change 2020use Symfony \Component \HttpClient \MockHttpClient ;
2121use Symfony \Component \Security \Core \Exception \UserNotFoundException ;
2222use Symfony \Component \Security \Core \Security as DeprecatedSecurity ;
23+ use Symfony \Component \Security \Http \SecurityRequestAttributes ;
2324use Symfony \Contracts \HttpClient \HttpClientInterface ;
2425
2526final class LoginControllerTest extends WebTestCase
@@ -84,6 +85,12 @@ public function testLoginPageWithError(): void
8485
8586 private function getSecurityErrorKey (): string
8687 {
88+ // Symfony 6.4+ compatibility
89+ if (class_exists (SecurityRequestAttributes::class)) {
90+ return SecurityRequestAttributes::AUTHENTICATION_ERROR ;
91+ }
92+
93+ // Symfony 5.4 & <6.4 compatibility
8794 return class_exists (Security::class) ? Security::AUTHENTICATION_ERROR : DeprecatedSecurity::AUTHENTICATION_ERROR ;
8895 }
8996}
You can’t perform that action at this time.
0 commit comments