You are here

public function OgMembershipTest::isRoleValidProvider in Organic groups 8

Data provider for testIsRoleValid().

Return value

array An array of test data, each test case containing the following 4 items: 1. The entity type ID of the role. 2. The bundle ID of the role. 3. The role name. 4. A boolean indicating whether or not this role is expected to be valid.

File

tests/src/Kernel/Entity/OgMembershipTest.php, line 406

Class

OgMembershipTest
Tests the OgMembership entity.

Namespace

Drupal\Tests\og\Kernel\Entity

Code

public function isRoleValidProvider() {
  return [
    // A valid role.
    [
      'entity_test',
      'entity_test',
      'administrator',
      TRUE,
    ],
    // An invalid role which has the wrong group entity type.
    [
      'user',
      'entity_test',
      'administrator',
      FALSE,
    ],
    // An invalid role which has the wrong group bundle.
    [
      'entity_test',
      'incorrect_bundle',
      'administrator',
      FALSE,
    ],
    // A non-member role is never valid for any membership.
    [
      'entity_test',
      'entity_test',
      OgRoleInterface::ANONYMOUS,
      FALSE,
    ],
  ];
}