You are here

public function DefaultRoleEventTest::testIteratorAggregate in Organic groups 8

Tests "testIteratorAggregate".

@covers ::getIterator

@dataProvider defaultRoleProvider

Parameters

array $roles: An array of test default roles.

File

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

Class

DefaultRoleEventTest
Tests default role events.

Namespace

Drupal\Tests\og\Unit

Code

public function testIteratorAggregate(array $roles) {
  $this
    ->expectOgRoleCreation($roles);
  $this->defaultRoleEvent
    ->setRoles($roles);
  foreach ($this->defaultRoleEvent as $name => $role) {
    $this
      ->assertRoleEquals($roles[$name], $role);
    unset($roles[$name]);
  }

  // Verify that all roles were iterated over.
  $this
    ->assertEmpty($roles);
}