function AndExpressionTest::testTwoFalseConditions
Tests two false conditions.
File
-
tests/
src/ Unit/ AndExpressionTest.php, line 81
Class
- AndExpressionTest
- @coversDefaultClass \Drupal\rules\Plugin\RulesExpression\AndExpression @group Rules
Namespace
Drupal\Tests\rules\UnitCode
public function testTwoFalseConditions() {
// The method on the test condition must be called once.
$this->falseConditionExpression
->executeWithState(Argument::type(ExecutionStateInterface::class))
->shouldBeCalledTimes(1);
$second_condition = $this->prophesize(ConditionExpressionInterface::class);
$second_condition->getUuid()
->willReturn('false_uuid2');
$second_condition->getWeight()
->willReturn(0);
// Evaluation of an AND condition group should stop with first FALSE.
// The second condition should not be evaluated.
$second_condition->executeWithState(Argument::type(ExecutionStateInterface::class))
->willReturn(FALSE)
->shouldNotBeCalled();
$this->and
->addExpressionObject($this->falseConditionExpression
->reveal())
->addExpressionObject($second_condition->reveal());
$this->assertFalse($this->and
->execute(), 'Two false conditions return FALSE.');
}