You are here

protected function GroupRoleSynchronizationTest::createUserRole in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/GroupRoleSynchronizationTest.php \Drupal\Tests\group\Kernel\GroupRoleSynchronizationTest::createUserRole()

Creates a user role.

Parameters

string $id: The ID of the user role to create. Label will be set to the ID with the first letter converted to upper case.

Return value

\Drupal\user\RoleInterface The created user role.

5 calls to GroupRoleSynchronizationTest::createUserRole()
GroupRoleSynchronizationTest::testConfigImport in tests/src/Kernel/GroupRoleSynchronizationTest.php
Tests whether an imported group type receives synchronized group roles.
GroupRoleSynchronizationTest::testGroupTypeCreation in tests/src/Kernel/GroupRoleSynchronizationTest.php
Tests whether a new group type receives synchronized group roles.
GroupRoleSynchronizationTest::testUserRoleCreation in tests/src/Kernel/GroupRoleSynchronizationTest.php
Tests whether a new user role syncs to group roles.
GroupRoleSynchronizationTest::testUserRoleDelete in tests/src/Kernel/GroupRoleSynchronizationTest.php
Tests whether a deleted user role syncs to group roles.
GroupRoleSynchronizationTest::testUserRoleUpdate in tests/src/Kernel/GroupRoleSynchronizationTest.php
Tests whether an updated user role syncs to group roles.

File

tests/src/Kernel/GroupRoleSynchronizationTest.php, line 43

Class

GroupRoleSynchronizationTest
Tests whether group roles are actually synchronized.

Namespace

Drupal\Tests\group\Kernel

Code

protected function createUserRole($id) {
  $role = $this->entityTypeManager
    ->getStorage('user_role')
    ->create([
    'id' => $id,
    'label' => ucfirst($id),
  ]);
  $role
    ->save();
  return $role;
}