use Symfony\Component\Ldap\Security\LdapBadge;
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
class LdapAuthenticatorTest extends TestCase
{ public function testAuthenticate() { $decorated =
$this->
createMock(AuthenticatorInterface::
class);
$passport =
new Passport(new UserBadge('test'
),
new PasswordCredentials('s3cret'
));
$decorated ->
expects($this->
once()) ->
method('authenticate'
) ->
willReturn($passport) ;
$authenticator =
new LdapAuthenticator($decorated, 'serviceId'
);
$request =
new Request();
$authenticator->
authenticate($request);