Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
onTransition example
$this
->validator =
$this
->
createMock
(
ValidatorInterface::
class
)
;
$roleHierarchy
=
new
RoleHierarchy
(
[
]
)
;
$this
->listener =
new
GuardListener
(
$this
->configuration,
$expressionLanguage
,
$tokenStorage
,
$this
->authenticationChecker,
$trustResolver
,
$roleHierarchy
,
$this
->validator
)
;
}
public
function
testWithNotSupportedEvent
(
)
{
$event
=
$this
->
createEvent
(
)
;
$this
->
configureAuthenticationChecker
(
false
)
;
$this
->
configureValidator
(
false
)
;
$this
->listener->
onTransition
(
$event
, 'not supported'
)
;
$this
->
assertFalse
(
$event
->
isBlocked
(
)
)
;
}
public
function
testWithSecuritySupportedEventAndReject
(
)
{
$event
=
$this
->
createEvent
(
)
;
$this
->
configureAuthenticationChecker
(
true, false
)
;
$this
->listener->
onTransition
(
$event
, 'test_is_granted'
)
;