-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests for the laravel dusk exception
Signed-off-by: Tonko Mulder <[email protected]>
- Loading branch information
Tonko Mulder
committed
Sep 13, 2019
1 parent
36baa56
commit f71ba5d
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
tests/Solutions/RunningLaravelDuskInProductionSolutionProviderTest.php
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,30 @@ | ||
<?php | ||
|
||
namespace Facade\Ignition\Tests\Solutions; | ||
|
||
use Exception; | ||
use Facade\Ignition\Tests\TestCase; | ||
use Facade\Ignition\SolutionProviders\RunningLaravelDuskInProductionProvider; | ||
|
||
class RunningLaravelDuskInProductionSolutionProviderTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function it_can_solve_dusk_in_production_exception() | ||
{ | ||
$exception = $this->generate_dusk_exception(); | ||
$canSolve = app(RunningLaravelDuskInProductionProvider::class)->canSolve($exception); | ||
[$first_solution, $second_solution] = app(RunningLaravelDuskInProductionProvider::class)->getSolutions($exception); | ||
|
||
$this->assertTrue($canSolve); | ||
$this->assertSame($first_solution->getSolutionTitle(), 'Laravel Dusk should not be run in production.'); | ||
$this->assertSame($first_solution->getSolutionDescription(), 'Install the dependencies with the `--no-dev` flag.'); | ||
|
||
$this->assertSame($second_solution->getSolutionTitle(), 'Laravel Dusk can be run in other environments.'); | ||
$this->assertSame($second_solution->getSolutionDescription(), 'Consider setting the `APP_ENV` to something other than `production` like `local` for example.'); | ||
} | ||
|
||
private function generate_dusk_exception(): Exception | ||
{ | ||
return new Exception('It is unsafe to run Dusk in production.'); | ||
} | ||
} |