Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
MenuLinkContentAccessControlHandler example
$language
->
expects
(
$this
->
any
(
)
)
->
method
(
'getId'
)
->
willReturn
(
'de'
)
;
$entity
=
$this
->
createMock
(
ContentEntityInterface::
class
)
;
$entity
->
expects
(
$this
->
any
(
)
)
->
method
(
'language'
)
->
willReturn
(
$language
)
;
$account
=
$this
->
createMock
(
AccountInterface::
class
)
;
$accessControl
=
new
MenuLinkContentAccessControlHandler
(
$entityType
,
$accessManager
)
;
$accessControl
->
setModuleHandler
(
$moduleHandler
)
;
$access
=
$accessControl
->
access
(
$entity
, 'not-an-op',
$account
, TRUE
)
;
$this
->
assertInstanceOf
(
AccessResultInterface::
class
,
$access
)
;
}
}