You are here

public function DefaultRoleEventTest::invalidDefaultRoleProvider in Organic groups 8

Provides invalid test data to test default roles.

Return value

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

File

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

Class

DefaultRoleEventTest
Tests default role events.

Namespace

Drupal\Tests\og\Unit

Code

public function invalidDefaultRoleProvider() {
  return [
    // A role with a missing name.
    [
      [
        '' => [
          'label' => $this
            ->t('Administrator'),
        ],
      ],
    ],
    // An array of multiple correct roles, with one invalid role type sneaked
    // in.
    [
      [
        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,
        ],
        'role with missing name' => [
          'label' => $this
            ->t('Invalid role'),
        ],
      ],
    ],
  ];
}