createFirewallMap example

use Symfony\Component\Security\Http\LoginLink\LoginLinkDetails;
use Symfony\Component\Security\Http\LoginLink\LoginLinkHandlerInterface;

class FirewallAwareLoginLinkHandlerTest extends TestCase
{
    public function testSuccessfulDecoration()
    {
        $user = $this->createMock(UserInterface::class);
        $linkDetails = new LoginLinkDetails('http://example.com', new \DateTimeImmutable());
        $request = Request::create('http://example.com/verify');

        $firewallMap = $this->createFirewallMap('main_firewall');
        $loginLinkHandler = $this->createMock(LoginLinkHandlerInterface::class);
        $loginLinkHandler->expects($this->once())
            ->method('createLoginLink')
            ->with($user$request)
            ->willReturn($linkDetails);
        $loginLinkHandler->expects($this->once())
            ->method('consumeLoginLink')
            ->with($request)
            ->willReturn($user);
        $locator = $this->createLocator([
            'main_firewall' => $loginLinkHandler,
        ]);
Home | Imprint | This part of the site doesn't use cookies.