You are here

public function AddSingleOgMembershipRoleActionTest::executeProvider in Organic groups 8

Data provider for testExecute().

Overrides ActionTestBase::executeProvider

File

tests/src/Kernel/Action/AddSingleOgMembershipRoleActionTest.php, line 52

Class

AddSingleOgMembershipRoleActionTest
Tests the AddSingleOgMembershipRole action plugin.

Namespace

Drupal\Tests\og\Kernel\Action

Code

public function executeProvider() {

  // It should be possible to add roles to any membership, regardless if they
  // are pending or blocked, or have any other membership.
  return [
    // If no default role is passed, the plugin should default to the first
    // available role (administrator).
    [
      'member',
      NULL,
      'administrator',
    ],
    [
      'member',
      'administrator',
      'administrator',
    ],
    [
      'member',
      'moderator',
      'moderator',
    ],
    [
      'pending',
      NULL,
      'administrator',
    ],
    [
      'pending',
      'administrator',
      'administrator',
    ],
    [
      'pending',
      'moderator',
      'moderator',
    ],
    [
      'blocked',
      NULL,
      'administrator',
    ],
    [
      'blocked',
      'administrator',
      'administrator',
    ],
    [
      'blocked',
      'moderator',
      'moderator',
    ],
    [
      'group_administrator',
      NULL,
      'administrator',
    ],
    // If an administrator is given the administrator role a second time, the
    // role should be kept intact.
    [
      'group_administrator',
      'administrator',
      'administrator',
    ],
    [
      'group_administrator',
      'moderator',
      'moderator',
    ],
    // If an administrator is also made a moderator, they should still keep
    // the administrator role.
    [
      'group_administrator',
      'moderator',
      'administrator',
    ],
    [
      'group_moderator',
      NULL,
      'administrator',
    ],
    [
      'group_moderator',
      'administrator',
      'administrator',
    ],
    // If a moderator is given the moderator role a second time, the role
    // should be kept intact.
    [
      'group_moderator',
      'moderator',
      'moderator',
    ],
    // If a moderator is also made an administrator, they should still keep
    // the moderator role.
    [
      'group_moderator',
      'administrator',
      'moderator',
    ],
  ];
}