Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
EntityCreateAccessCheck example
$access_control_handler
=
$this
->
createMock
(
'Drupal\Core\Entity\EntityAccessControlHandlerInterface'
)
;
$access_control_handler
->
expects
(
$this
->
once
(
)
)
->
method
(
'createAccess'
)
->
with
(
$entity_bundle
)
->
willReturn
(
$access_result
)
;
$this
->entityTypeManager->
expects
(
$this
->
any
(
)
)
->
method
(
'getAccessControlHandler'
)
->
willReturn
(
$access_control_handler
)
;
}
$applies_check
=
new
EntityCreateAccessCheck
(
$this
->entityTypeManager
)
;
$route
=
$this
->
getMockBuilder
(
'Symfony\Component\Routing\Route'
)
->
disableOriginalConstructor
(
)
->
getMock
(
)
;
$route
->
expects
(
$this
->
any
(
)
)
->
method
(
'getRequirement'
)
->
with
(
'_entity_create_access'
)
->
willReturn
(
$requirement
)
;
$raw_variables
=
new
InputBag
(
)
;
if
(
$entity_bundle
)
{