static::
assertNotContains('unit:read',
$privileges);
static::
assertContains('system:clear:cache',
$privileges);
static::
assertContains('system.plugin_maintain',
$privileges);
} public function testGetAdditionalPrivilegesEvent(): void
{ $getAdditionalPrivileges =
function DAclGetAdditionalPrivilegesEvent
$event): void
{ $privileges =
$event->
getPrivileges();
static::
assertContains('system:clear:cache',
$privileges);
$privileges[] = 'my_custom_privilege';
$event->
setPrivileges($privileges);
};
$this->
addEventListener($this->
getContainer()->
get('event_dispatcher'
), AclGetAdditionalPrivilegesEvent::
class,
$getAdditionalPrivileges);
$this->
getBrowser()->
request('GET', '/api/_action/acl/additional_privileges'
);
$response =
$this->
getBrowser()->
getResponse();
$privileges =
json_decode($response->
getContent(), true, 512, \JSON_THROW_ON_ERROR
);
static::
assertNotContains('unit:read',
$privileges);
static::
assertContains('system:clear:cache',
$privileges);
static::
assertContains('my_custom_privilege',
$privileges);
}