예제 #1
0
 /**
  * Transit to a new state.
  *
  * @param Transition      $transition      The transition being performed.
  * @param Context         $context         The transition context.
  * @param ErrorCollection $errorCollection The error collection.
  * @param bool            $success         The success state.
  *
  * @return State
  */
 public function transit(Transition $transition, Context $context, ErrorCollection $errorCollection, $success = true)
 {
     $dateTime = new DateTime();
     $stepName = $success ? $transition->getStepTo()->getName() : $this->stepName;
     return new static($this->entityId, $this->workflowName, $transition->getName(), $stepName, $success, $context->getProperties(), $dateTime, $errorCollection->getErrors());
 }
예제 #2
0
 function it_transits_to_next_state(Transition $transition, Context $context, ErrorCollection $errorCollection)
 {
     $context->getProperties()->willReturn(array());
     $errorCollection->getErrors()->willReturn(array());
     $this->transit($transition, $context, $errorCollection, false)->shouldBeAnInstanceOf('Netzmacht\\Workflow\\Flow\\State');
 }