You are here

public function DefaultRoleEventTest::defaultRoleProvider in Organic groups 8

Provides test data to test default roles.

Return value

array An array of test data arrays, each test data array containing an array of test default roles, keyed by default role name.

File

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

Class

DefaultRoleEventTest
Tests default role events.

Namespace

Drupal\Tests\og\Unit

Code

public function defaultRoleProvider() {
  return [
    // Test adding a single administrator role with only the required
    // properties.
    [
      [
        OgRoleInterface::ADMINISTRATOR => [
          'name' => OgRoleInterface::ADMINISTRATOR,
          'label' => $this
            ->t('Administrator'),
        ],
      ],
    ],
    // Test adding a single administrator role with a label and role type.
    [
      [
        OgRoleInterface::ADMINISTRATOR => [
          'name' => OgRoleInterface::ADMINISTRATOR,
          'label' => $this
            ->t('Administrator'),
          'role_type' => OgRoleInterface::ROLE_TYPE_REQUIRED,
        ],
      ],
    ],
    // Test adding multiple roles.
    [
      [
        OgRoleInterface::ADMINISTRATOR => [
          'name' => OgRoleInterface::ADMINISTRATOR,
          'label' => $this
            ->t('Administrator'),
          'role_type' => OgRoleInterface::ROLE_TYPE_REQUIRED,
        ],
        'moderator' => [
          'name' => 'moderator',
          'label' => $this
            ->t('Moderator'),
          'role_type' => OgRoleInterface::ROLE_TYPE_STANDARD,
        ],
        'contributor' => [
          'name' => 'contributor',
          'label' => $this
            ->t('Contributor'),
        ],
      ],
    ],
  ];
}