File tree Expand file tree Collapse file tree 4 files changed +25
-4
lines changed
Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -123,4 +123,14 @@ function it_can_not_get_step_after_last(
123123
124124 $ this ->getStepAfter ($ stepCurrent )->shouldReturn (null );
125125 }
126+
127+ function it_can_get_first_step (
128+ MultiStepInterface $ firstStep
129+ ) {
130+ $ firstStep ->getId ()->willReturn ('first-step ' );
131+ $ firstStep ->getSlug ()->willReturn ('first-step ' );
132+ $ this ->addStep ($ firstStep );
133+
134+ $ this ->getFirstStep ()->shouldReturn ($ firstStep );
135+ }
126136}
Original file line number Diff line number Diff line change @@ -104,4 +104,13 @@ public function addStep(MultiStepInterface $step): void
104104 $ this ->steps [$ step ->getId ()] = $ step ;
105105 $ this ->stepsBySlug [$ step ->getSlug ()] = $ step ;
106106 }
107+
108+ public function getFirstStep (): MultiStepInterface
109+ {
110+ if (empty ($ this ->steps )) {
111+ throw new StepNotFoundException ();
112+ }
113+ reset ($ this ->steps );
114+ return current ($ this ->steps );
115+ }
107116}
Original file line number Diff line number Diff line change @@ -32,4 +32,6 @@ public function getStepAfter(MultiStepInterface $currentStep): ?MultiStepInterfa
3232 public function getStepBefore (MultiStepInterface $ currentStep ): ?MultiStepInterface ;
3333
3434 public function addStep (MultiStepInterface $ step ): void ;
35+
36+ public function getFirstStep (): MultiStepInterface ;
3537}
Original file line number Diff line number Diff line change 11services :
22 sd.multistep.step_factory :
3- class : sd\Morpheus \MultiStepBundle\Factory\MultiStepFactory
3+ class : solutionDrive \MultiStepBundle\Factory\MultiStepFactory
44
55 sd.multistep.flow_factory :
6- class : sd\Morpheus \MultiStepBundle\Factory\MultiStepFlowFactory
6+ class : solutionDrive \MultiStepBundle\Factory\MultiStepFlowFactory
77 arguments :
88 - " @sd.multistep.step_factory"
99
1010 sd.multistep.flow_registry :
11- class : sd\Morpheus \MultiStepBundle\Registry\MultiStepFlowRegistry
11+ class : solutionDrive \MultiStepBundle\Registry\MultiStepFlowRegistry
1212 arguments :
1313 - " @sd.multistep.flow_factory"
1414
1515 sd.multistep.controller :
16- class : sd\Morpheus \MultiStepBundle\Controller\MultiStepController
16+ class : solutionDrive \MultiStepBundle\Controller\MultiStepController
1717 arguments :
1818 - " @sd.multistep.flow_registry"
1919 - " @controller_resolver"
You can’t perform that action at this time.
0 commit comments