You are here

public function DefaultRoleEventTest::testHasRole in Organic groups 8

Tests checking OG roles exist in a default role event.

@covers ::hasRole

@dataProvider defaultRoleProvider

Parameters

array $roles: An array of test default roles.

File

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

Class

DefaultRoleEventTest
Tests default role events.

Namespace

Drupal\Tests\og\Unit

Code

public function testHasRole(array $roles) {
  $this
    ->expectOgRoleCreation($roles);
  foreach ($roles as $name => $role) {
    $this
      ->assertFalse($this->defaultRoleEvent
      ->hasRole($name));
    $this->defaultRoleEvent
      ->addRole($role);
    $this
      ->assertTrue($this->defaultRoleEvent
      ->hasRole($name));
  }
}