You are here

public function ChangeMultipleOgMembershipRolesActionTestBase::testExecute in Organic groups 8

Checks if the action can be performed correctly.

@covers ::execute @dataProvider executeProvider

Parameters

string $membership: The membership on which to perform the action.

Overrides ActionTestBase::testExecute

File

tests/src/Kernel/Action/ChangeMultipleOgMembershipRolesActionTestBase.php, line 113

Class

ChangeMultipleOgMembershipRolesActionTestBase
Base class for tests for plugins that change multiple roles at once.

Namespace

Drupal\Tests\og\Kernel\Action

Code

public function testExecute($membership) {

  // Log in as a group administrator. The memberships to change will be stored
  // in the private temporary storage of the logged in user. We do not need to
  // check any permissions on this user since it is already handled by the
  // access test.
  // @see \Drupal\Tests\og\Kernel\Action\ActionTestBase::testAccess()
  $this
    ->setCurrentUser($this->testUser);

  /** @var \Drupal\og\Plugin\Action\AddMultipleOgMembershipRoles $plugin */
  $plugin = $this
    ->getPlugin();
  $plugin
    ->execute($this->memberships[$membership]);

  // The plugin's only responsibility is to store the memberships in temporary
  // storage. The actual processing of the memberships will be handled in the
  // confirmation form.
  $this
    ->assertStoredMemberships([
    $membership,
  ]);
}