This repository was archived by the owner on Dec 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
93 additions
and
0 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 |
---|---|---|
|
@@ -27,5 +27,8 @@ | |
"Bread\\BreadServiceProvider" | ||
] | ||
} | ||
}, | ||
"require-dev": { | ||
"orchestra/testbench-dusk": "3.8" | ||
} | ||
} |
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,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="tests/bootstrap.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
|
||
<testsuites> | ||
<testsuite name="Browser"> | ||
<directory suffix="Test.php">./tests/Browser</directory> | ||
</testsuite> | ||
<testsuite name="Unit"> | ||
<directory suffix="Test.php">./tests/Unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist addUncoveredFilesFromWhitelist="false"> | ||
<directory suffix=".php">src/</directory> | ||
</whitelist> | ||
</filter> | ||
|
||
<php> | ||
<env name="APP_ENV" value="testing"/> | ||
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/> | ||
<env name="DB_CONNECTION" value="sqlite"/> | ||
</php> | ||
</phpunit> |
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,53 @@ | ||
<?php | ||
|
||
namespace Bread\Tests\Browser; | ||
|
||
use Laravel\Dusk\Browser; | ||
use Orchestra\Testbench\Dusk\TestCase; | ||
|
||
class RouteTest extends TestCase | ||
{ | ||
protected function getEnvironmentSetUp($app) | ||
{ | ||
$app['router']->get('hello', ['as' => 'hi', 'uses' => function () { | ||
return 'hello world'; | ||
}]); | ||
$app['router']->get('config', ['as' => 'hi', 'uses' => function () { | ||
return config('new_config_item'); | ||
}]); | ||
} | ||
|
||
/** @test */ | ||
public function can_use_dusk() | ||
{ | ||
$this->browse(function (Browser $browser) { | ||
$browser->visit('hello') | ||
->assertSee('hello world'); | ||
}); | ||
} | ||
|
||
/** @test */ | ||
public function can_use_multiple_browsers() | ||
{ | ||
$this->browse(function (Browser $browser, Browser $browserTwo) { | ||
$browser->visit('hello') | ||
->assertSee('hello world'); | ||
$browserTwo->visit('hello') | ||
->assertSee('hello world'); | ||
}); | ||
} | ||
|
||
/** @test */ | ||
public function can_tweak_the_application_within_a_test() | ||
{ | ||
$this->tweakApplication(function ($app) { | ||
$app['config']->set('new_config_item', 'Fantastic!'); | ||
}); | ||
$this->assertEquals('Fantastic!', config('new_config_item')); | ||
$this->browse(function (Browser $browser, Browser $browserTwo) { | ||
$browser->visit('config') | ||
->assertSee('Fantastic!'); | ||
}); | ||
$this->removeApplicationTweaks(); | ||
} | ||
} |
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,5 @@ | ||
<?php | ||
|
||
include __DIR__.'/../vendor/autoload.php'; | ||
|
||
Orchestra\Testbench\Dusk\Options::withoutUI(); |