generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from musa11971/livewire-testing
Add `Component::testStep` to allow easy testing of wizard StepComponents
- Loading branch information
Showing
6 changed files
with
82 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.idea | ||
.php_cs | ||
.php_cs.cache | ||
.phpunit.cache | ||
.phpunit.result.cache | ||
build | ||
composer.lock | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
use Spatie\LivewireWizard\Tests\TestSupport\Components\MyWizardComponent; | ||
use Spatie\LivewireWizard\Tests\TestSupport\Components\Steps\FirstStepComponent; | ||
use Spatie\LivewireWizard\Tests\TestSupport\Components\Steps\SecondStepComponent; | ||
|
||
it('can test a step without state', function () { | ||
MyWizardComponent::testStep(FirstStepComponent::class) | ||
->assertSee('first step'); | ||
}); | ||
|
||
it('can test a step with initial state', function () { | ||
MyWizardComponent::testStep(SecondStepComponent::class, [ | ||
'first-step' => [ | ||
'order' => 220, | ||
] | ||
]) | ||
->assertSee('Order value is: 220'); | ||
}); | ||
|
||
it('cannot test a step with invalid initial state', function () { | ||
MyWizardComponent::testStep(SecondStepComponent::class, [ | ||
'random-fake-step' => [ | ||
'order' => 220, | ||
] | ||
]); | ||
})->throws(Exception::class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters