You are here

public function OgRoleManagerTest::testGetRolesByBundle in Organic groups 8

Tests that all roles are loaded for a certain group.

@covers ::getRolesByBundle

File

tests/src/Kernel/OgRoleManagerTest.php, line 96

Class

OgRoleManagerTest
Kernel tests for the OG role manager service.

Namespace

Drupal\Tests\og\Kernel

Code

public function testGetRolesByBundle() {
  $expected_role_ids = [
    'node-node_group_type-administrator',
    'node-node_group_type-member',
    'node-node_group_type-non-member',
    'node-node_group_type-' . $this->roleName,
  ];
  $roles = $this->ogRoleManager
    ->getRolesByBundle('node', 'node_group_type');
  $role_ids = array_keys($roles);
  sort($expected_role_ids);
  sort($role_ids);
  $this
    ->assertEquals($expected_role_ids, $role_ids);
}