From c9a8c6ff6085a77ab52084fde3de38641b32ed19 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 Mar 2021 22:40:36 +0100 Subject: [PATCH] Fix tests --- .../Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php index 3b30e7ffb3..51483c9997 100644 --- a/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php @@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\Routing\RequestContext; use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; @@ -65,6 +66,12 @@ class LoginLinkHandlerTest extends TestCase ) ->willReturn('https://example.com/login/verify?user=weaverryan&hash=abchash&expires=1601235000'); + if ($request) { + $this->router->expects($this->once()) + ->method('getContext') + ->willReturn(new RequestContext()); + } + $loginLink = $this->createLinker([], array_keys($extraProperties))->createLoginLink($user, $request); $this->assertSame('https://example.com/login/verify?user=weaverryan&hash=abchash&expires=1601235000', $loginLink->getUrl()); }