private Request
$request;
private PersistentRememberMeHandler
$handler;
protected function setUp(): void
{ $this->tokenProvider =
$this->
createMock(TokenProviderInterface::
class);
$this->userProvider =
new InMemoryUserProvider();
$this->userProvider->
createUser(new InMemoryUser('wouter', null
));
$this->requestStack =
new RequestStack();
$this->request = Request::
create('/login'
);
$this->requestStack->
push($this->request
);
$this->handler =
new PersistentRememberMeHandler($this->tokenProvider,
$this->userProvider,
$this->requestStack,
[]);
} public function testCreateRememberMeCookie() { $this->tokenProvider->
expects($this->
once()) ->
method('createNewToken'
) ->
with($this->
callback(fn ($persistentToken) =>
$persistentToken instanceof PersistentToken
&& 'wouter' ===
$persistentToken->
getUserIdentifier() && InMemoryUser::
class === $persistentToken->
getClass()));
$this->handler->
createRememberMeCookie(new InMemoryUser('wouter', null
));
}