Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add currentStepIndex to summary #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/AbstractWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public function summary(): array

return [
'id' => $this->id,
'currentStepIndex' => $this->currentStep,
'slug' => static::$slug,
'title' => $this->title(),
'steps' => collect($this->steps)->map(fn (WizardStep $step) => [
Expand Down
11 changes: 11 additions & 0 deletions tests/WizardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,17 @@ public function it_returns_the_wizards_slug_in_the_summary(): void
self::assertEquals($wizard::$slug, $summary['slug']);
}

/** @test */
public function it_returns_the_wizards_current_step_index_in_the_summary(): void
{
$wizard = $this->createWizard(TestWizard::class);
$wizard->show(new Request(), '1', 'step-with-view-data');

$summary = $wizard->summary();

self::assertEquals(1, $summary['currentStepIndex']);
}

/** @test */
public function it_returns_the_slug_of_each_step_in_the_summary(): void
{
Expand Down