protected function GroupLevelAccessTest::setupGroupEntityOperationPermissions in Organic groups 8
Returns test users with permissions to perform group entity operations.
Return value
\Drupal\user\UserInterface[] The test users.
1 call to GroupLevelAccessTest::setupGroupEntityOperationPermissions()
- GroupLevelAccessTest::testGroupEntityOperationPermissions in tests/
src/ Kernel/ Access/ GroupLevelAccessTest.php - Test access to the entity operation permissions on groups.
File
- tests/
src/ Kernel/ Access/ GroupLevelAccessTest.php, line 307
Class
- GroupLevelAccessTest
- Tests user access to group level entity operations and permissions.
Namespace
Drupal\Tests\og\Kernel\AccessCode
protected function setupGroupEntityOperationPermissions() : array {
// Return the users from the generic test setup.
$users = [
'owner' => $this->ownerUser,
'non-member' => $this->nonMemberUser,
'admin' => $this->adminUser,
'alternative-admin' => $this->alternativeAdminUser,
];
// A group member with the group level permission 'update group' which maps
// to the 'update' entity operation.
$role_with_update_permission = $this
->createOgRole([
OgAccess::UPDATE_GROUP_PERMISSION,
]);
$user = $this
->createUserWithOgRole($role_with_update_permission);
$users['update'] = $user;
// A group member with the group level permission 'delete group' which maps
// to the 'delete' entity operation.
$role_with_delete_permission = $this
->createOgRole([
OgAccess::DELETE_GROUP_PERMISSION,
]);
$user = $this
->createUserWithOgRole($role_with_delete_permission);
$users['delete'] = $user;
return $users;
}