$authenticator->
expects($this->
once())->
method('onAuthenticationFailure'
)->
with($this->
anything(),
$this->
callback(fn ($exception) => 'Authentication failed; Some badges marked as required by the firewall config are not available on the passport: "'.CsrfTokenBadge::
class.'".' ===
$exception->
getMessage()));
$manager =
$this->
createManager([$authenticator], 'main', true,
[CsrfTokenBadge::
class]);
$manager->
authenticateRequest($this->request
);
} public function testAllRequiredBadgesPresent() { $authenticator =
$this->
createAuthenticator();
$this->request->attributes->
set('_security_authenticators',
[$authenticator]);
$csrfBadge =
new CsrfTokenBadge('csrfid', 'csrftoken'
);
$csrfBadge->
markResolved();
$authenticator->
expects($this->
any())->
method('authenticate'
)->
willReturn(new SelfValidatingPassport(new UserBadge('wouter'
),
[$csrfBadge]));
$authenticator->
expects($this->
any())->
method('createToken'
)->
willReturn(new UsernamePasswordToken($this->user, 'main'
));
$authenticator->
expects($this->
once())->
method('onAuthenticationSuccess'
);
$manager =
$this->
createManager([$authenticator], 'main', true,
[CsrfTokenBadge::
class]);
$manager->
authenticateRequest($this->request
);
} /**
* @dataProvider provideEraseCredentialsData
*/