function it_transits_to_a_successful_state(EntityId $entityId, State $state, State $newState, EntityId $entityId, Transition $transition, Context $context, ErrorCollection $errorCollection) { $state->getStepName()->willReturn('start'); $state->getWorkflowName()->willReturn('workflow_name'); $state->isSuccessful()->willReturn(true); $state->transit(Argument::cetera())->willReturn($newState); $newState->getWorkflowName()->willReturn('workflow_name'); $newState->getStepName()->willReturn('target'); $newState->isSuccessful()->willReturn(true); $this->it_restores_state_history($entityId, $state); $this->transit($transition, $context, $errorCollection, true); $this->getCurrentStepName()->shouldReturn('target'); $this->getWorkflowName()->shouldReturn('workflow_name'); $this->getStateHistory()->shouldReturn(array($state, $newState)); $this->getLatestState()->shouldHaveType('Netzmacht\\Workflow\\Flow\\State'); $this->getLatestState()->shouldNotBe($state); }