Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
IsGrantedAttributeController example
class
IsGrantedAttributeListenerTest
extends
TestCase
{
public
function
testAttribute
(
)
{
$authChecker
=
$this
->
createMock
(
AuthorizationCheckerInterface::
class
)
;
$authChecker
->
expects
(
$this
->
exactly
(
2
)
)
->
method
(
'isGranted'
)
->
willReturn
(
true
)
;
$event
=
new
ControllerArgumentsEvent
(
$this
->
createMock
(
HttpKernelInterface::
class
)
,
[
new
IsGrantedAttributeController
(
)
, 'foo'
]
,
[
]
,
new
Request
(
)
,
null
)
;
$listener
=
new
IsGrantedAttributeListener
(
$authChecker
)
;
$listener
->
onKernelControllerArguments
(
$event
)
;
$authChecker
=
$this
->
createMock
(
AuthorizationCheckerInterface::
class
)
;
$authChecker
->
expects
(
$this
->
once
(
)
)
->
method
(
'isGranted'
)