You are here

public function OrExpressionTest::testTwoFalseConditions in Rules 8.3

Tests two false conditions.

File

tests/src/Unit/OrExpressionTest.php, line 81

Class

OrExpressionTest
@coversDefaultClass \Drupal\rules\Plugin\RulesExpression\OrExpression @group Rules

Namespace

Drupal\Tests\rules\Unit

Code

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);
  $second_condition
    ->executeWithState(Argument::type(ExecutionStateInterface::class))
    ->willReturn(FALSE)
    ->shouldBeCalledTimes(1);
  $this->or
    ->addExpressionObject($this->falseConditionExpression
    ->reveal())
    ->addExpressionObject($second_condition
    ->reveal());
  $this
    ->assertFalse($this->or
    ->execute(), 'Two false conditions return FALSE.');
}