RememberMeAuthenticator example

class RememberMeAuthenticatorTest extends TestCase
{
    private MockObject&RememberMeHandlerInterface $rememberMeHandler;
    private TokenStorage $tokenStorage;
    private RememberMeAuthenticator $authenticator;

    protected function setUp(): void
    {
        $this->rememberMeHandler = $this->createMock(RememberMeHandlerInterface::class);
        $this->tokenStorage = new TokenStorage();
        $this->authenticator = new RememberMeAuthenticator($this->rememberMeHandler, 's3cr3t', $this->tokenStorage, '_remember_me_cookie');
    }

    public function testSupportsTokenStorageWithToken()
    {
        $this->tokenStorage->setToken(new UsernamePasswordToken(new InMemoryUser('username', 'credentials'), 'main'));

        $this->assertFalse($this->authenticator->supports(Request::create('/')));
    }

    /** * @dataProvider provideSupportsData */
Home | Imprint | This part of the site doesn't use cookies.