public function GroupRoleSynchronizationTest::testModuleInstalled in Group 2.0.x
Same name and namespace in other branches
- 8 tests/src/Kernel/GroupRoleSynchronizationTest.php \Drupal\Tests\group\Kernel\GroupRoleSynchronizationTest::testModuleInstalled()
Tests whether a module with user roles receives synchronized group roles.
@covers \Drupal\group\Entity\Storage\GroupRoleStorage::createSynchronized @uses group_modules_installed
File
- tests/
src/ Kernel/ GroupRoleSynchronizationTest.php, line 129
Class
- GroupRoleSynchronizationTest
- Tests whether group roles are actually synchronized.
Namespace
Drupal\Tests\group\KernelCode
public function testModuleInstalled() {
$defaultGroupRoleId = $this->groupRoleSynchronizer
->getGroupRoleId('default', 'test');
$otherGroupRoleId = $this->groupRoleSynchronizer
->getGroupRoleId('other', 'test');
$group_roles = $this->entityTypeManager
->getStorage('group_role')
->loadMultiple();
$this
->assertArrayHasKey($defaultGroupRoleId, $group_roles, 'Synchronized role found for default group type');
$this
->assertArrayHasKey($otherGroupRoleId, $group_roles, 'Synchronized role found for other group type');
$this
->assertEquals('Test', $group_roles[$otherGroupRoleId]
->label(), 'Synchronized roles share the same label');
$this
->assertEquals(99, $group_roles[$otherGroupRoleId]
->getWeight(), 'Synchronized roles share the same weight');
}