Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
onCheckPassport example
$this
->ldap =
$this
->
createMock
(
LdapInterface::
class
)
;
}
/** * @dataProvider provideShouldNotCheckPassport */
public
function
testShouldNotCheckPassport
(
$authenticator
,
$passport
)
{
$this
->ldap->
expects
(
$this
->
never
(
)
)
->
method
(
'bind'
)
;
$listener
=
$this
->
createListener
(
)
;
$listener
->
onCheckPassport
(
new
CheckPassportEvent
(
$authenticator
,
$passport
)
)
;
}
public
static
function
provideShouldNotCheckPassport
(
)
{
// no LdapBadge
yield
[
new
TestAuthenticator
(
)
,
new
Passport
(
new
UserBadge
(
'test'
)
,
new
PasswordCredentials
(
's3cret'
)
)
]
;
// ldap already resolved
$badge
=
new
LdapBadge
(
'app.ldap'
)
;
$badge
->
markResolved
(
)
;
yield
[
new
TestAuthenticator
(
)
,
new
Passport
(
new
UserBadge
(
'test'
)
,
new
PasswordCredentials
(
's3cret'
)
,
[
$badge
]
)
]
;
}