/** * Calculates progress based on current step index. * * @param int $currentStepIndex */ protected function calculateProgress($currentStepIndex) { $this->progress = floor(($currentStepIndex + 1) / $this->process->countSteps() * 100); }
function it_rewind_history($storage, ProcessInterface $process, StepInterface $currentStep, StepInterface $previousStep, StepInterface $nextStep) { $currentStep->getName()->willReturn('step_two'); $process->getScenarioAlias()->shouldBeCalled(); $storage->initialize(Argument::type('string'))->shouldBeCalled(); $process->getOrderedSteps()->shouldBeCalled()->willReturn(array($previousStep, $currentStep, $nextStep)); $process->countSteps()->shouldBeCalled()->willReturn(2); $this->initialize($process, $currentStep); $storage->get("history", array())->shouldBeCalled()->willreturn(array("step_one", "step_two", "step_three")); $storage->set('history', array('step_one', 'step_two'))->shouldBeCalled(); $this->rewindHistory(); }