function ActionSetExpressionTest::testEvaluationOrder
Tests evaluation order with two actions.
File
-
tests/
src/ Unit/ ActionSetExpressionTest.php, line 113
Class
- ActionSetExpressionTest
- @coversDefaultClass \Drupal\rules\Plugin\RulesExpression\ActionSetExpression @group Rules
Namespace
Drupal\Tests\rules\UnitCode
public function testEvaluationOrder() {
// The execute method on the second action must be called once.
$this->testActionExpression
->executeWithState(Argument::type(ExecutionStateInterface::class))
->shouldBeCalledTimes(1);
// The execute method on the test action must be called once.
$this->testFirstActionExpression
->executeWithState(Argument::type(ExecutionStateInterface::class))
->shouldBeCalledTimes(1);
// The 'first' action should be called first, because of weight,
// even though it is added second.
$this->actionSet
->addExpressionObject($this->testActionExpression
->reveal())
->addExpressionObject($this->testFirstActionExpression
->reveal());
// The $result variable is a test-only variable to hold the return value
// of test actions, which normally don't return a value. We do this so we
// can verify the order of execution.
$this->assertEquals([
'action_uuid0',
'action_uuid1',
], $this->actionSet
->execute());
}