Skip to content

Commit

Permalink
Remove throw StepNotFoundException
Browse files Browse the repository at this point in the history
  • Loading branch information
ycs77 committed Jun 1, 2024
1 parent de463e4 commit 29bb003
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 74 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"homepage": "https://github.com/ycs77/laravel-wizard",
"require": {
"php": ">=8.1",
"facade/ignition-contracts": "^1.0",
"laravel/framework": ">=9.0"
},
"require-dev": {
Expand Down
18 changes: 0 additions & 18 deletions src/Exceptions/InternalException.php

This file was deleted.

41 changes: 0 additions & 41 deletions src/Exceptions/StepNotFoundException.php

This file was deleted.

5 changes: 1 addition & 4 deletions src/Wizardable.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Closure;
use Illuminate\Http\Request;
use Ycs77\LaravelWizard\Exceptions\StepNotFoundException;

trait Wizardable
{
Expand Down Expand Up @@ -316,8 +315,6 @@ protected function getLastProcessedStepIndex(string $stepSlug = null)
* @param \Illuminate\Http\Request $request
* @param string|null $slug
* @return \Ycs77\LaravelWizard\Step
*
* @throws \Ycs77\LaravelWizard\Exceptions\StepNotFoundException
*/
protected function getWizardStep(Request $request, string $slug = null)
{
Expand All @@ -330,7 +327,7 @@ protected function getWizardStep(Request $request, string $slug = null)
}

if (is_null($step)) {
throw new StepNotFoundException($slug, $this->wizard, static::class);
abort(404);
}

$this->wizard()->stepRepo()->setCurrentIndex($step->index());
Expand Down
11 changes: 1 addition & 10 deletions tests/Feature/HttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,12 @@ public function testRunAllWizardStepsSaveOnLastStepAndCanBeCachedUploadedFile()
]);
}

public function testThrowStepNotFoundException()
public function testStepNotFound()
{
$this->app['config']->set('app.debug', false);

$response = $this->get('/wizard/test/step-not-found');
$response->assertStatus(404);
}

public function testThrowStepNotFoundExceptionFromDebugMode()
{
$response = $this->get('/wizard/test/step-not-found');
$response->assertStatus(500);
$response->assertSee('Step [step-not-found] is not found to Test wizard.');
}

public function testWizardStepNotEquialToLastProcessedStep()
{
$this->session([
Expand Down

0 comments on commit 29bb003

Please sign in to comment.