File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
Expand file tree Collapse file tree 3 files changed +21
-0
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}
You can’t perform that action at this time.
0 commit comments