Skip to content

Commit 07adcd5

Browse files
committed
Fix Serializable deprecations triggered by token mocks
1 parent 6d4089e commit 07adcd5

19 files changed

+30
-18
lines changed

Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Session\SessionInterface;
1717
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
18-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1918
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler;
2019
use Symfony\Component\Security\Http\HttpUtils;
20+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2121

2222
class DefaultAuthenticationSuccessHandlerTest extends TestCase
2323
{

Tests/Authentication/SimpleAuthenticationHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
18-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1918
use Symfony\Component\Security\Core\Exception\AuthenticationException;
2019
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
2120
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
2221
use Symfony\Component\Security\Http\Authentication\SimpleAuthenticationHandler;
22+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2323

2424
/**
2525
* @group legacy

Tests/Firewall/AbstractPreAuthenticatedListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
1818
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
1919
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
20-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2120
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
2221
use Symfony\Component\Security\Core\Exception\AuthenticationException;
2322
use Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener;
23+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2424

2525
class AbstractPreAuthenticatedListenerTest extends TestCase
2626
{

Tests/Firewall/AccessListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
1919
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
2020
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
21-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2221
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
2322
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
2423
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
2524
use Symfony\Component\Security\Http\AccessMapInterface;
2625
use Symfony\Component\Security\Http\Event\LazyResponseEvent;
2726
use Symfony\Component\Security\Http\Firewall\AccessListener;
27+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2828

2929
class AccessListenerTest extends TestCase
3030
{

Tests/Firewall/AnonymousAuthenticationListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
2020
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
2121
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
22-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2322
use Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener;
23+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2424

2525
class AnonymousAuthenticationListenerTest extends TestCase
2626
{

Tests/Firewall/BasicAuthenticationListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
2121
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
2222
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
23-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2423
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
2524
use Symfony\Component\Security\Core\Exception\AuthenticationException;
2625
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
2726
use Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener;
27+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2828

2929
class BasicAuthenticationListenerTest extends TestCase
3030
{

Tests/Firewall/ExceptionListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
use Symfony\Component\HttpKernel\HttpKernelInterface;
2020
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
2121
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
22-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2322
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
2423
use Symfony\Component\Security\Core\Exception\AuthenticationException;
2524
use Symfony\Component\Security\Core\Exception\LogoutException;
2625
use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
2726
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
2827
use Symfony\Component\Security\Http\Firewall\ExceptionListener;
2928
use Symfony\Component\Security\Http\HttpUtils;
29+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
3030

3131
class ExceptionListenerTest extends TestCase
3232
{

Tests/Firewall/LogoutListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\HttpKernel\Event\RequestEvent;
1818
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
19-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2019
use Symfony\Component\Security\Core\Exception\LogoutException;
2120
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
2221
use Symfony\Component\Security\Http\Firewall\LogoutListener;
2322
use Symfony\Component\Security\Http\HttpUtils;
2423
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
2524
use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
25+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2626

2727
class LogoutListenerTest extends TestCase
2828
{

Tests/Firewall/RememberMeListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
use Symfony\Component\HttpKernel\HttpKernelInterface;
2121
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
2222
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
23-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2423
use Symfony\Component\Security\Core\Exception\AuthenticationException;
2524
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
2625
use Symfony\Component\Security\Http\Firewall\RememberMeListener;
2726
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
2827
use Symfony\Component\Security\Http\SecurityEvents;
2928
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
29+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
3030
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
3131

3232
class RememberMeListenerTest extends TestCase

Tests/Firewall/SimplePreAuthenticationListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
use Symfony\Component\HttpKernel\Event\RequestEvent;
1919
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
2020
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
21-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2221
use Symfony\Component\Security\Core\Exception\AuthenticationException;
2322
use Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface;
2423
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
2524
use Symfony\Component\Security\Http\Firewall\SimplePreAuthenticationListener;
2625
use Symfony\Component\Security\Http\SecurityEvents;
26+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2727

2828
/**
2929
* @group legacy

Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Symfony\Component\Security\Http\Firewall\UsernamePasswordJsonAuthenticationListener;
2929
use Symfony\Component\Security\Http\HttpUtils;
3030
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
31+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface as StrictTokenInterface;
3132

3233
/**
3334
* @author Kévin Dunglas <[email protected]>
@@ -50,7 +51,7 @@ private function createListener(array $options = [], $success = true, $matchChec
5051
;
5152
$authenticationManager = $this->createMock(AuthenticationManagerInterface::class);
5253

53-
$authenticatedToken = $this->createMock(TokenInterface::class);
54+
$authenticatedToken = $this->createMock(StrictTokenInterface::class);
5455

5556
if ($success) {
5657
$authenticationManager->method('authenticate')->willReturn($authenticatedToken);

Tests/Fixtures/TokenInterface.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\Security\Http\Tests\Fixtures;
4+
5+
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface as BaseTokenInterface;
6+
7+
interface TokenInterface extends BaseTokenInterface
8+
{
9+
public function __serialize(): array;
10+
public function __unserialize(array $data): void;
11+
}

Tests/Logout/CookieClearingLogoutHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
19-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2019
use Symfony\Component\Security\Http\Logout\CookieClearingLogoutHandler;
20+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2121

2222
class CookieClearingLogoutHandlerTest extends TestCase
2323
{

Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\HttpFoundation\Session\Session;
1818
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
19-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2019
use Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage;
2120
use Symfony\Component\Security\Http\Logout\CsrfTokenClearingLogoutHandler;
21+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2222

2323
class CsrfTokenClearingLogoutHandlerTest extends TestCase
2424
{

Tests/Logout/SessionLogoutHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\HttpFoundation\Session\Session;
18-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1918
use Symfony\Component\Security\Http\Logout\SessionLogoutHandler;
19+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2020

2121
class SessionLogoutHandlerTest extends TestCase
2222
{

Tests/RememberMe/AbstractRememberMeServicesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
use Symfony\Component\HttpFoundation\Cookie;
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
18-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1918
use Symfony\Component\Security\Core\User\UserInterface;
2019
use Symfony\Component\Security\Core\User\UserProviderInterface;
2120
use Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices;
2221
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
22+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2323

2424
class AbstractRememberMeServicesTest extends TestCase
2525
{

Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken;
2020
use Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface;
2121
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
22-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2322
use Symfony\Component\Security\Core\Exception\CookieTheftException;
2423
use Symfony\Component\Security\Core\Exception\TokenNotFoundException;
2524
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
2625
use Symfony\Component\Security\Core\User\UserInterface;
2726
use Symfony\Component\Security\Core\User\UserProviderInterface;
2827
use Symfony\Component\Security\Http\RememberMe\PersistentTokenBasedRememberMeServices;
2928
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
29+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
3030

3131
class PersistentTokenBasedRememberMeServicesTest extends TestCase
3232
{

Tests/RememberMe/TokenBasedRememberMeServicesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
1919
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
20-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2120
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
2221
use Symfony\Component\Security\Core\User\UserInterface;
2322
use Symfony\Component\Security\Core\User\UserProviderInterface;
2423
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
2524
use Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices;
25+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
2626

2727
class TokenBasedRememberMeServicesTest extends TestCase
2828
{

Tests/Session/SessionAuthenticationStrategyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Session\SessionInterface;
17-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1817
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy;
18+
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
1919

2020
class SessionAuthenticationStrategyTest extends TestCase
2121
{

0 commit comments

Comments
 (0)