public function ChangeMultipleOgMembershipRolesActionTestBase::testExecuteMultiple in Organic groups 8
Checks if the action can be performed correctly.
@covers ::executeMultiple @dataProvider executeMultipleProvider
Parameters
array $membership_ids: The memberships on which to perform the action.
File
- tests/
src/ Kernel/ Action/ ChangeMultipleOgMembershipRolesActionTestBase.php, line 50
Class
- ChangeMultipleOgMembershipRolesActionTestBase
- Base class for tests for plugins that change multiple roles at once.
Namespace
Drupal\Tests\og\Kernel\ActionCode
public function testExecuteMultiple(array $membership_ids) {
// 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);
$memberships = $this->memberships;
$memberships = array_filter($memberships, function ($membership_id) use ($membership_ids) {
return in_array($membership_id, $membership_ids);
}, ARRAY_FILTER_USE_KEY);
/** @var \Drupal\og\Plugin\Action\AddMultipleOgMembershipRoles $plugin */
$plugin = $this
->getPlugin();
$plugin
->executeMultiple($memberships);
// 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_ids);
}