function RuleExpressionTest::testActionExecution

Tests that an action fires if a condition passes.

@covers ::execute

File

tests/src/Unit/RuleExpressionTest.php, line 109

Class

RuleExpressionTest
@coversDefaultClass \Drupal\rules\Plugin\RulesExpression\RuleExpression @group Rules

Namespace

Drupal\Tests\rules\Unit

Code

public function testActionExecution() {
    // The method on the test action must be called once.
    $this->testActionExpression
        ->executeWithState(Argument::type(ExecutionStateInterface::class))
        ->shouldBeCalledTimes(1);
    $this->rule
        ->addExpressionObject($this->trueConditionExpression
        ->reveal())
        ->addExpressionObject($this->testActionExpression
        ->reveal())
        ->execute();
}