function RuleExpressionTest::testTwoConditionsFalse

Tests that an action does not fire if a condition fails.

@covers ::execute

File

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

Class

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

Namespace

Drupal\Tests\rules\Unit

Code

public function testTwoConditionsFalse() {
    // The execute method on the action must never be called.
    $this->testActionExpression
        ->executeWithState(Argument::type(ExecutionStateInterface::class))
        ->shouldNotBeCalled();
    $this->testActionExpression
        ->getWeight()
        ->willReturn(0);
    $this->trueConditionExpression
        ->getWeight()
        ->willReturn(0);
    $this->falseConditionExpression
        ->getWeight()
        ->willReturn(0);
    $this->rule
        ->addExpressionObject($this->trueConditionExpression
        ->reveal())
        ->addExpressionObject($this->falseConditionExpression
        ->reveal())
        ->addExpressionObject($this->testActionExpression
        ->reveal())
        ->execute();
}