Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
postCheckCredentials example
public
function
testPreAuthenticatedBadge
(
)
{
$this
->userChecker->
expects
(
$this
->
never
(
)
)
->
method
(
'checkPreAuth'
)
;
$this
->listener->
preCheckCredentials
(
$this
->
createCheckPassportEvent
(
new
SelfValidatingPassport
(
new
UserBadge
(
'test',
fn
(
)
=>
$this
->user
)
,
[
new
PreAuthenticatedUserBadge
(
)
]
)
)
)
;
}
public
function
testPostAuthValidCredentials
(
)
{
$this
->userChecker->
expects
(
$this
->
once
(
)
)
->
method
(
'checkPostAuth'
)
->
with
(
$this
->user
)
;
$this
->listener->
postCheckCredentials
(
new
AuthenticationSuccessEvent
(
new
PostAuthenticationToken
(
$this
->user, 'main',
[
]
)
)
)
;
}
private
function
createCheckPassportEvent
(
$passport
= null
)
{
$passport
??=
new
SelfValidatingPassport
(
new
UserBadge
(
'test',
fn
(
)
=>
$this
->user
)
)
;
return
new
CheckPassportEvent
(
$this
->
createMock
(
AuthenticatorInterface::
class
)
,
$passport
)
;
}
private
function
createAuthenticationSuccessEvent
(
)
{