RememberMeListener example

class RememberMeListenerTest extends TestCase
{
    private MockObject&RememberMeHandlerInterface $rememberMeHandler;
    private RememberMeListener $listener;
    private Request $request;
    private Response $response;

    protected function setUp(): void
    {
        $this->rememberMeHandler = $this->createMock(RememberMeHandlerInterface::class);
        $this->listener = new RememberMeListener($this->rememberMeHandler);
        $this->request = Request::create('/login');
        $this->request->request->set('_remember_me', true);
        $this->response = new Response();
    }

    public function testSuccessfulLoginWithoutSupportingAuthenticator()
    {
        $this->rememberMeHandler->expects($this->never())->method('createRememberMeCookie');

        $event = $this->createLoginSuccessfulEvent($this->createPassport([]));
        $this->listener->onSuccessfulLogin($event);
    }
Home | Imprint | This part of the site doesn't use cookies.