protected function setUp(): void
{ $this->csrfTokenManager =
$this->
createMock(CsrfTokenManagerInterface::
class);
$this->listener =
new CsrfProtectionListener($this->csrfTokenManager
);
} public function testNoCsrfTokenBadge() { $this->csrfTokenManager->
expects($this->
never())->
method('isTokenValid'
);
$event =
$this->
createEvent($this->
createPassport(null
));
$this->listener->
checkPassport($event);
} public function testValidCsrfToken() { $this->csrfTokenManager->
expects($this->
any()) ->
method('isTokenValid'
) ->
with(new CsrfToken('authenticator_token_id', 'abc123'
)) ->
willReturn(true
);
$event =
$this->
createEvent($this->
createPassport(new CsrfTokenBadge('authenticator_token_id', 'abc123'
)));