예제 #1
0
 function it_does_not_match_if_one_child_does_not(Condition $conditionA, Condition $conditionB, Transition $transition, Item $item, Context $context, ErrorCollection $errorCollection)
 {
     $conditionA->match($transition, $item, $context, Argument::type(self::ERROR_COLLECTION_CLASS))->willReturn(true);
     $conditionB->match($transition, $item, $context, Argument::type(self::ERROR_COLLECTION_CLASS))->willReturn(false);
     $errorCollection->addError(Argument::cetera())->shouldBeCalled();
     $this->addCondition($conditionA);
     $this->addCondition($conditionB);
     $this->match($transition, $item, $context, $errorCollection)->shouldReturn(false);
 }
예제 #2
0
 /**
  * Perform condition check.
  *
  * @param Condition|null  $condition       Condition to be checked.
  * @param Item            $item            Workflow item.
  * @param Context         $context         Condition context.
  * @param ErrorCollection $errorCollection Error collection.
  *
  * @return bool
  */
 private function performConditionCheck($condition, $item, $context, ErrorCollection $errorCollection)
 {
     if (!$condition) {
         return true;
     }
     return $condition->match($this, $item, $context, $errorCollection);
 }
예제 #3
0
 function it_only_recognize_precondition_when_input_is_required(Condition $preCondition, Condition $condition, Item $item, Context $context, ErrorCollection $errorCollection, Action $action)
 {
     $preCondition->match($this, $item, $context, Argument::type(self::ERROR_COLLECTION_CLASS))->willReturn(true);
     $condition->match($this, $item, $context, Argument::type(self::ERROR_COLLECTION_CLASS))->willReturn(false);
     $action->isInputRequired($item)->willReturn(true);
     $this->addAction($action);
     $this->addCondition($condition);
     $this->addPreCondition($preCondition);
     $this->isAvailable($item, $context, $errorCollection)->shouldReturn(true);
 }