function ActionSetExpressionTest::testDeletingAction

Tests deleting an action from the container.

File

tests/src/Unit/ActionSetExpressionTest.php, line 95

Class

ActionSetExpressionTest
@coversDefaultClass \Drupal\rules\Plugin\RulesExpression\ActionSetExpression @group Rules

Namespace

Drupal\Tests\rules\Unit

Code

public function testDeletingAction() {
    $this->actionSet
        ->addExpressionObject($this->testActionExpression
        ->reveal());
    $second_action = $this->prophesize(ActionExpression::class);
    $this->actionSet
        ->addExpressionObject($second_action->reveal());
    // Get the UUID of the first action added.
    $uuid = $this->testActionExpression
        ->reveal()
        ->getUuid();
    $this->assertTrue($this->actionSet
        ->deleteExpression($uuid));
    // Now only the second action remains.
    foreach ($this->actionSet as $action) {
        $this->assertSame($second_action->reveal(), $action);
    }
}