예제 #1
0
 function it_converts_to_array(ErrorCollection $errorCollection)
 {
     $errors = array(array(static::MESSAGE, static::$params, null), array(static::MESSAGE, static::$params, $errorCollection));
     $errorCollection->toArray()->shouldBeCalled()->willReturn(array(array(static::MESSAGE, static::$params, null)));
     $this->addErrors($errors)->shouldReturn($this);
     $this->toArray()->shouldReturn(array(array(static::MESSAGE, static::$params, null), array(static::MESSAGE, static::$params, array(array(static::MESSAGE, static::$params, null)))));
 }
예제 #2
0
 function it_starts_a_new_workflow_state(EntityId $entityId, State $state, EntityId $entityId, Transition $transition, Workflow $workflow, Step $step, Context $context, ErrorCollection $errorCollection)
 {
     $transition->getWorkflow()->willReturn($workflow);
     $transition->getName()->willReturn('transition_name');
     $transition->getStepTo()->willReturn($step);
     $context->getProperties()->willReturn(array());
     $errorCollection->toArray()->willReturn(array());
     $this->beConstructedThrough('initialize', array($entityId, static::$entity));
     $this->start($transition, $context, $errorCollection, true)->shouldHaveType('Netzmacht\\Workflow\\Flow\\State');
 }
예제 #3
0
 /**
  * Create an initial state.
  *
  * @param EntityId        $entityId        The entity id.
  * @param Transition      $transition      The current executed transition.
  * @param Context         $context         The context.
  * @param ErrorCollection $errorCollection The error collection.
  * @param bool            $success         Success state.
  *
  * @return State
  */
 public static function start(EntityId $entityId, Transition $transition, Context $context, ErrorCollection $errorCollection, $success)
 {
     $state = new State($entityId, $transition->getWorkflow()->getName(), $transition->getName(), $transition->getStepTo()->getName(), $success, $context->getProperties(), new \DateTime(), $errorCollection->toArray());
     return $state;
 }