DataListItemRemoveTest.php in Rules 8.3
File
tests/src/Unit/Integration/RulesAction/DataListItemRemoveTest.php
View source
<?php
namespace Drupal\Tests\rules\Unit\Integration\RulesAction;
use Drupal\Tests\rules\Unit\Integration\RulesIntegrationTestBase;
class DataListItemRemoveTest extends RulesIntegrationTestBase {
protected $action;
protected function setUp() : void {
parent::setUp();
$this->action = $this->actionManager
->createInstance('rules_list_item_remove');
}
public function testSummary() {
$this
->assertEquals('Remove item from list', $this->action
->summary());
}
public function testActionExecution() {
$list = [
'One',
'Two',
'Three',
];
$this->action
->setContextValue('list', $list)
->setContextValue('item', 'Two');
$this->action
->execute();
$this
->assertEquals([
'One',
'Three',
], array_values($this->action
->getContextValue('list')));
}
}