Esempio n. 1
0
 function it_knows_if_transition_is_available_for_an_item(Item $item, Step $step, Context $context, Transition $transition, ErrorCollection $errorCollection)
 {
     $item->isWorkflowStarted()->willReturn(true);
     $item->getCurrentStepName()->willReturn('started');
     $transition->getName()->willReturn('next');
     $transition->isAvailable($item, $context, $errorCollection)->shouldBeCalled()->willReturn(true);
     $this->addTransition($transition);
     $step->getName()->willReturn('started');
     $step->isTransitionAllowed('next')->willReturn(true);
     $this->addStep($step);
     $this->isTransitionAvailable($item, $context, $errorCollection, 'next')->shouldReturn(true);
 }
Esempio n. 2
0
 function it_throws_than_matches_workflow_is_not_same_as_current(Workflow $workflow, Item $item, EntityId $entityId, Transition $transition, Step $step)
 {
     $step->getName()->willReturn('start');
     $step->isTransitionAllowed('next')->willReturn(true);
     $item->getEntityId()->willReturn($entityId);
     $item->getEntity()->willReturn(static::$entity);
     $item->isWorkflowStarted()->willReturn(true);
     $item->getCurrentStepName()->willReturn('start');
     $item->getWorkflowName()->willReturn('workflow_a');
     $workflow->match($entityId, static::$entity)->willReturn(true);
     $workflow->getStep('start')->willReturn($step);
     $workflow->getTransition('next')->willReturn($transition);
     $workflow->getName()->willReturn('workflow_b');
     $entityId->getProviderName()->willReturn(static::ENTITY_PROVIDER_NAME);
     $entityId->__toString()->willReturn(static::ENTITY_PROVIDER_NAME . '::' . static::ENTITY_ID);
     $this->shouldThrow('Netzmacht\\Workflow\\Flow\\Exception\\WorkflowException')->duringHandle($item, 'next');
 }