You are here

public function GroupRoleSynchronizationTest::testUserRoleDelete in Group 2.0.x

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

Tests whether a deleted user role syncs to group roles.

@coversNothing

File

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

Class

GroupRoleSynchronizationTest
Tests whether group roles are actually synchronized.

Namespace

Drupal\Tests\group\Kernel

Code

public function testUserRoleDelete() {
  $role = $this
    ->createUserRole('editor');
  $role
    ->delete();
  $defaultGroupRoleId = $this->groupRoleSynchronizer
    ->getGroupRoleId('default', 'editor');
  $group_roles = $this->entityTypeManager
    ->getStorage('group_role')
    ->loadMultiple();
  $this
    ->assertArrayNotHasKey($defaultGroupRoleId, $group_roles, 'Synchronized role not found for deleted global role');
}