Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
preCheckCredentials example
protected
function
setUp
(
)
: void
{
$this
->userChecker =
$this
->
createMock
(
UserCheckerInterface::
class
)
;
$this
->listener =
new
UserCheckerListener
(
$this
->userChecker
)
;
$this
->user =
new
InMemoryUser
(
'test', null
)
;
}
public
function
testPreAuth
(
)
{
$this
->userChecker->
expects
(
$this
->
once
(
)
)
->
method
(
'checkPreAuth'
)
->
with
(
$this
->user
)
;
$this
->listener->
preCheckCredentials
(
$this
->
createCheckPassportEvent
(
)
)
;
}
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
(
)
{