public function PermissionEventTest::testDeleteGroupContentOperationPermission in Organic groups 8
Tests deleting a group content permission.
@covers ::deleteGroupContentOperationPermission
@dataProvider groupContentOperationPermissionsProvider
Parameters
\Drupal\og\GroupContentOperationPermission[] $permissions: An array of test permissions.
string $entity_type_id: The entity type ID of the group type to which the permissions apply.
string $bundle_id: The bundle ID of the group type to which the permissions apply.
array $group_content_bundle_ids: An array of group content bundle IDs to which the permissions apply, keyed by group content entity type ID.
File
- tests/
src/ Unit/ PermissionEventTest.php, line 226
Class
- PermissionEventTest
- Tests permission events.
Namespace
Drupal\Tests\og\UnitCode
public function testDeleteGroupContentOperationPermission(array $permissions, $entity_type_id, $bundle_id, array $group_content_bundle_ids) {
$event = new PermissionEvent($entity_type_id, $bundle_id, $group_content_bundle_ids);
$event
->setPermissions($permissions);
foreach ($permissions as $permission) {
$name = $permission
->getName();
$permission_entity_type_id = $permission
->getEntityType();
$permission_bundle_id = $permission
->getBundle();
$permission_operation = $permission
->getOperation();
$permission_ownership = $permission
->getOwner();
// Before we delete the permission, it should still be there.
$this
->assertTrue($event
->hasPermission($name));
// After we delete the permission, it should be gone.
$event
->deleteGroupContentOperationPermission($permission_entity_type_id, $permission_bundle_id, $permission_operation, $permission_ownership);
$this
->assertFalse($event
->hasPermission($name));
}
}