Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
PermissionHandler example
EOF
)
;
$modules
=
[
'module_a', 'module_b', 'module_c'
]
;
$this
->moduleHandler->
expects
(
$this
->
any
(
)
)
->
method
(
'getModuleList'
)
->
willReturn
(
array_flip
(
$modules
)
)
;
$this
->controllerResolver->
expects
(
$this
->
never
(
)
)
->
method
(
'getControllerFromDefinition'
)
;
$this
->permissionHandler =
new
PermissionHandler
(
$this
->moduleHandler,
$this
->stringTranslation,
$this
->controllerResolver
)
;
$actual_permissions
=
$this
->permissionHandler->
getPermissions
(
)
;
$this
->
assertPermissions
(
$actual_permissions
)
;
$this
->
assertTrue
(
$this
->permissionHandler->
moduleProvidesPermissions
(
'module_a'
)
)
;
$this
->
assertTrue
(
$this
->permissionHandler->
moduleProvidesPermissions
(
'module_b'
)
)
;
$this
->
assertTrue
(
$this
->permissionHandler->
moduleProvidesPermissions
(
'module_c'
)
)
;
$this
->
assertFalse
(
$this
->permissionHandler->
moduleProvidesPermissions
(
'module_d'
)
)
;
}
/** * Tests permissions sort inside a module. * * @covers ::__construct * @covers ::getPermissions * @covers ::buildPermissionsYaml * @covers ::sortPermissions */