function OrExpressionTest::testTwoConditions

Tests two true conditions.

File

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

Class

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

Namespace

Drupal\Tests\rules\Unit

Code

public function testTwoConditions() {
    // The method on the test condition must be called once.
    $this->trueConditionExpression
        ->executeWithState(Argument::type(ExecutionStateInterface::class))
        ->shouldBeCalledTimes(1);
    $second_condition = $this->prophesize(ConditionExpressionInterface::class);
    $second_condition->getUuid()
        ->willReturn('true_uuid2');
    $second_condition->getWeight()
        ->willReturn(0);
    $second_condition->executeWithState(Argument::type(ExecutionStateInterface::class))
        ->willReturn(TRUE)
        ->shouldNotBeCalled();
    $this->or
        ->addExpressionObject($this->trueConditionExpression
        ->reveal())
        ->addExpressionObject($second_condition->reveal());
    $this->assertTrue($this->or
        ->execute(), 'Two conditions returns TRUE.');
}