From 48e76fafc6acd3aa62396c8b979cd9f935706563 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sat, 5 Jun 2021 18:29:25 +0200 Subject: [PATCH] Fix Serializable deprecations triggered by token mocks --- src/Symfony/Bridge/Twig/Tests/AppVariableTest.php | 2 +- .../Bridge/Twig/Tests/Fixtures/TokenInterface.php | 11 +++++++++++ .../FrameworkBundle/Tests/Fixtures/TokenInterface.php | 11 +++++++++++ .../Tests/Templating/GlobalVariablesTest.php | 2 +- .../SecurityBundle/Tests/Fixtures/TokenInterface.php | 11 +++++++++++ .../Tests/Functional/EventAliasTest.php | 2 +- .../Tests/SecurityUserValueResolverTest.php | 2 +- .../AuthenticationProviderManagerTest.php | 2 +- .../AuthenticationTrustResolverTest.php | 2 +- .../Provider/AnonymousAuthenticationProviderTest.php | 2 +- .../PreAuthenticatedAuthenticationProviderTest.php | 2 +- .../Provider/RememberMeAuthenticationProviderTest.php | 2 +- .../Provider/SimpleAuthenticationProviderTest.php | 2 +- .../Provider/UserAuthenticationProviderTest.php | 2 +- .../Token/Storage/UsageTrackingTokenStorageTest.php | 2 +- .../Tests/Authorization/AccessDecisionManagerTest.php | 2 +- .../TraceableAccessDecisionManagerTest.php | 2 +- .../Authorization/Voter/AuthenticatedVoterTest.php | 2 +- .../Tests/Authorization/Voter/ExpressionVoterTest.php | 2 +- .../Core/Tests/Authorization/Voter/RoleVoterTest.php | 2 +- .../Tests/Authorization/Voter/TraceableVoterTest.php | 2 +- .../Core/Tests/Authorization/Voter/VoterTest.php | 3 ++- .../Security/Core/Tests/Fixtures/TokenInterface.php | 11 +++++++++++ .../Security/Core/Tests/Role/SwitchUserRoleTest.php | 2 +- .../Component/Security/Core/Tests/SecurityTest.php | 2 +- .../Constraints/UserPasswordValidatorTest.php | 2 +- .../Firewall/GuardAuthenticationListenerTest.php | 2 +- .../Guard/Tests/Fixtures/GuardTokenInterface.php | 11 +++++++++++ .../Security/Guard/Tests/Fixtures/TokenInterface.php | 11 +++++++++++ .../Guard/Tests/GuardAuthenticatorHandlerTest.php | 2 +- .../Provider/GuardAuthenticationProviderTest.php | 2 +- .../DefaultAuthenticationSuccessHandlerTest.php | 2 +- .../SimpleAuthenticationHandlerTest.php | 2 +- .../Firewall/AbstractPreAuthenticatedListenerTest.php | 2 +- .../Http/Tests/Firewall/AccessListenerTest.php | 2 +- .../Firewall/AnonymousAuthenticationListenerTest.php | 2 +- .../Firewall/BasicAuthenticationListenerTest.php | 2 +- .../Http/Tests/Firewall/ExceptionListenerTest.php | 2 +- .../Http/Tests/Firewall/LogoutListenerTest.php | 2 +- .../Http/Tests/Firewall/RememberMeListenerTest.php | 2 +- .../Firewall/SimplePreAuthenticationListenerTest.php | 2 +- ...UsernamePasswordJsonAuthenticationListenerTest.php | 3 ++- .../Security/Http/Tests/Fixtures/TokenInterface.php | 11 +++++++++++ .../Tests/Logout/CookieClearingLogoutHandlerTest.php | 2 +- .../Logout/CsrfTokenClearingLogoutHandlerTest.php | 2 +- .../Http/Tests/Logout/SessionLogoutHandlerTest.php | 2 +- .../RememberMe/AbstractRememberMeServicesTest.php | 2 +- .../PersistentTokenBasedRememberMeServicesTest.php | 2 +- .../RememberMe/TokenBasedRememberMeServicesTest.php | 2 +- .../Session/SessionAuthenticationStrategyTest.php | 2 +- 50 files changed, 122 insertions(+), 43 deletions(-) create mode 100644 src/Symfony/Bridge/Twig/Tests/Fixtures/TokenInterface.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TokenInterface.php create mode 100644 src/Symfony/Bundle/SecurityBundle/Tests/Fixtures/TokenInterface.php create mode 100644 src/Symfony/Component/Security/Core/Tests/Fixtures/TokenInterface.php create mode 100644 src/Symfony/Component/Security/Guard/Tests/Fixtures/GuardTokenInterface.php create mode 100644 src/Symfony/Component/Security/Guard/Tests/Fixtures/TokenInterface.php create mode 100644 src/Symfony/Component/Security/Http/Tests/Fixtures/TokenInterface.php diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php index f5fcbeada6..58c3cfde4b 100644 --- a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php +++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php @@ -4,12 +4,12 @@ namespace Symfony\Bridge\Twig\Tests; use PHPUnit\Framework\TestCase; use Symfony\Bridge\Twig\AppVariable; +use Symfony\Bridge\Twig\Tests\Fixtures\TokenInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\User\UserInterface; class AppVariableTest extends TestCase diff --git a/src/Symfony/Bridge/Twig/Tests/Fixtures/TokenInterface.php b/src/Symfony/Bridge/Twig/Tests/Fixtures/TokenInterface.php new file mode 100644 index 0000000000..b22e99e66d --- /dev/null +++ b/src/Symfony/Bridge/Twig/Tests/Fixtures/TokenInterface.php @@ -0,0 +1,11 @@ +token = $this->createMock(TokenInterface::class); + $this->token = $this->createMock(StrictTokenInterface::class); } public function getTests() diff --git a/src/Symfony/Component/Security/Core/Tests/Fixtures/TokenInterface.php b/src/Symfony/Component/Security/Core/Tests/Fixtures/TokenInterface.php new file mode 100644 index 0000000000..32a83deeb6 --- /dev/null +++ b/src/Symfony/Component/Security/Core/Tests/Fixtures/TokenInterface.php @@ -0,0 +1,11 @@ + @@ -50,7 +51,7 @@ class UsernamePasswordJsonAuthenticationListenerTest extends TestCase ; $authenticationManager = $this->createMock(AuthenticationManagerInterface::class); - $authenticatedToken = $this->createMock(TokenInterface::class); + $authenticatedToken = $this->createMock(StrictTokenInterface::class); if ($success) { $authenticationManager->method('authenticate')->willReturn($authenticatedToken); diff --git a/src/Symfony/Component/Security/Http/Tests/Fixtures/TokenInterface.php b/src/Symfony/Component/Security/Http/Tests/Fixtures/TokenInterface.php new file mode 100644 index 0000000000..254381cb23 --- /dev/null +++ b/src/Symfony/Component/Security/Http/Tests/Fixtures/TokenInterface.php @@ -0,0 +1,11 @@ +