You are here

public function DataListItemRemoveTest::testActionExecution in Rules 8.3

Tests the action execution.

@covers ::execute

File

tests/src/Unit/Integration/RulesAction/DataListItemRemoveTest.php, line 43

Class

DataListItemRemoveTest
@coversDefaultClass \Drupal\rules\Plugin\RulesAction\DataListItemRemove @group RulesAction

Namespace

Drupal\Tests\rules\Unit\Integration\RulesAction

Code

public function testActionExecution() {
  $list = [
    'One',
    'Two',
    'Three',
  ];
  $this->action
    ->setContextValue('list', $list)
    ->setContextValue('item', 'Two');
  $this->action
    ->execute();

  // The second item should be removed from the list.
  $this
    ->assertEquals([
    'One',
    'Three',
  ], array_values($this->action
    ->getContextValue('list')));
}