Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getAclRoleMock example
$pluginCollection
->
method
(
'getActives'
)
->
willReturnCallback
(
fn
(
)
=>
array_filter
(
$this
->plugins,
static
fn
(
Plugin
$plugin
)
=>
$plugin
->
isActive
(
)
)
)
;
$this
->pluginAclSubscriber =
new
PluginAclPrivilegesSubscriber
(
$pluginCollection
)
;
}
public
function
testAclPluginDeactivated
(
)
: void
{
$this
->
deactivatePlugin
(
self::PLUGIN_ACL_PRODUCT_VIEWER
)
;
$aclRoles
=
[
$this
->
getAclRoleMock
(
'pluginAclTestProductViewer',
[
'product.viewer', 'product:read'
]
)
]
;
$event
=
new
EntityLoadedEvent
(
$this
->
createMock
(
AclRoleDefinition::
class
)
,
$aclRoles
,
Context::
createDefaultContext
(
)
)
;
$this
->pluginAclSubscriber->
onAclRoleLoaded
(
$event
)
;
/** @var AclRoleEntity $enrichedAclRole */
$enrichedAclRole
=
$event
->
getEntities
(
)
[
0
]
;