Ejemplo n.º 1
0
 /**
  * Tests two false conditions.
  */
 public function testTwoFalseConditions()
 {
     // The method on the test condition must be called once.
     $this->falseConditionExpression->executeWithState(Argument::type(RulesStateInterface::class))->shouldBeCalledTimes(1);
     $this->and->addExpressionObject($this->falseConditionExpression->reveal())->addExpressionObject($this->falseConditionExpression->reveal());
     $this->assertFalse($this->and->execute(), 'Two false conditions return FALSE.');
 }
Ejemplo n.º 2
0
 /**
  * Tests two false conditions.
  */
 public function testTwoFalseConditions()
 {
     $this->falseConditionExpression->executeWithState(Argument::type(ExecutionStateInterface::class))->shouldBeCalledTimes(1);
     $second_condition = $this->prophesize(ConditionExpressionInterface::class);
     $second_condition->getUuid()->willReturn('false_uuid2');
     $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.');
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function addExpressionObject(ExpressionInterface $expression, $return_uuid = FALSE)
 {
     if ($expression instanceof ConditionExpressionInterface) {
         $result = $this->conditions->addExpressionObject($expression, $return_uuid);
     } elseif ($expression instanceof ActionExpressionInterface) {
         $result = $this->actions->addExpressionObject($expression, $return_uuid);
     } else {
         throw new InvalidExpressionException();
     }
     return $return_uuid ? $result : $this;
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function addExpressionObject(ExpressionInterface $expression)
 {
     if ($expression instanceof ConditionExpressionInterface) {
         $this->conditions->addExpressionObject($expression);
     } elseif ($expression instanceof ActionExpressionInterface) {
         $this->actions->addExpressionObject($expression);
     } else {
         throw new InvalidExpressionException();
     }
     return $this;
 }