Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
LdapAuthenticator example
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
)
;
/** @var LdapBadge $badge */
$badge
=
$passport
->
getBadge
(
LdapBadge::
class
)
;
$this
->
assertNotNull
(
$badge
)
;
$this
->
assertSame
(
'serviceId',
$badge
->
getLdapServiceId
(
)
)
;
}
}