public function DefaultRoleEventTest::testSetRole in Organic groups 8
Tests setting OG roles for the default role event.
@covers ::setRole
@dataProvider defaultRoleProvider
Parameters
array $roles: An array of test default roles.
File
- tests/
src/ Unit/ DefaultRoleEventTest.php, line 154
Class
- DefaultRoleEventTest
- Tests default role events.
Namespace
Drupal\Tests\og\UnitCode
public function testSetRole(array $roles) {
$this
->expectOgRoleCreation($roles);
foreach ($roles as $name => $role) {
$this
->assertFalse($this->defaultRoleEvent
->hasRole($name));
$this->defaultRoleEvent
->setRole($role);
$this
->assertRoleEquals($role, $this->defaultRoleEvent
->getRole($name));
// Setting a role a second time should be possible. No exception should be
// thrown.
$this->defaultRoleEvent
->setRole($role);
}
}