/** * {@inheritdoc} */ public function getTransition() { if ($this->isWorkflowStarted()) { return $this->workflow->getTransition($this->transitionName); } return $this->workflow->getStartTransition(); }
function let(Item $item, Workflow $workflow, StateRepository $stateRepository, EntityRepository $entityRepository, TransactionHandler $transactionHandler, SymfonyEventDispatcher $eventDispatcher, Transition $transition, State $state, EntityId $entityId, Step $step) { $workflow->getStep(static::STEP_NAME)->willReturn($step); $workflow->getStartTransition()->willReturn($transition); $workflow->getName()->willReturn(static::WORKFLOW_NAME); $step->isTransitionAllowed(static::TRANSITION_NAME)->willReturn(true); $workflow->getTransition(static::TRANSITION_NAME)->willReturn($transition); $transition->getName()->willReturn(static::TRANSITION_NAME); $transition->isInputRequired($item)->willReturn(false); $item->transit($transition, Argument::type(static::CONTEXT_CLASS), Argument::type(static::ERROR_COLLECTION_CLASS), true)->willReturn($state); $item->isWorkflowStarted()->willReturn(true); $item->getCurrentStepName()->willReturn(static::STEP_NAME); $item->getEntity()->willReturn(static::$entity); $entityId->__toString()->willReturn('entity::2'); $this->beConstructedWith($eventDispatcher); }
function it_throws_during_transits_if_not_validated(Workflow $workflow, Transition $transition) { $workflow->getStartTransition()->willReturn($transition); $this->shouldThrow('Netzmacht\\Workflow\\Flow\\Exception\\WorkflowException')->duringTransit(); }