You are here

public function DefaultRoleEventTest::testAddRoles in Organic groups 8

Tests adding OG roles to the default role event.

@covers ::addRoles

@dataProvider defaultRoleProvider

Parameters

array $roles: An array of test default roles.

File

tests/src/Unit/DefaultRoleEventTest.php, line 131

Class

DefaultRoleEventTest
Tests default role events.

Namespace

Drupal\Tests\og\Unit

Code

public function testAddRoles(array $roles) {
  $this
    ->expectOgRoleCreation($roles);
  $this->defaultRoleEvent
    ->addRoles($roles);
  $actual_roles = $this->defaultRoleEvent
    ->getRoles();
  foreach ($roles as $name => $role) {
    $this
      ->assertRoleEquals($role, $actual_roles[$name]);
  }
  $this
    ->assertEquals(count($roles), count($actual_roles));
}