From 50c1136be8f1bd1a0be0e8aee418b395a8999187 Mon Sep 17 00:00:00 2001 From: Gerardo Ibarra Date: Mon, 28 Dec 2020 13:13:30 -0300 Subject: [PATCH 1/2] MakeDuskTest --- src/Laravel/Commands/PestTestCommand.php | 4 ++-- stubs/Browser.php | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 stubs/Browser.php diff --git a/src/Laravel/Commands/PestTestCommand.php b/src/Laravel/Commands/PestTestCommand.php index 112b394b..32650161 100644 --- a/src/Laravel/Commands/PestTestCommand.php +++ b/src/Laravel/Commands/PestTestCommand.php @@ -19,7 +19,7 @@ final class PestTestCommand extends Command * * @var string */ - protected $signature = 'pest:test {name : The name of the file} {--unit : Create a unit test}'; + protected $signature = 'pest:test {name : The name of the file} {--unit : Create a unit test} {--dusk : Create a dusk test}'; /** * The console command description. @@ -36,7 +36,7 @@ final class PestTestCommand extends Command /** @var string $name */ $name = $this->argument('name'); - $type = ((bool) $this->option('unit')) ? 'Unit' : 'Feature'; + $type = ((bool) $this->option('unit')) ? 'Unit' : (((bool) $this->option('dusk')) ? 'Browser' : 'Feature'); $relativePath = sprintf('tests/%s/%s.php', $type, diff --git a/stubs/Browser.php b/stubs/Browser.php new file mode 100644 index 00000000..ad9f2218 --- /dev/null +++ b/stubs/Browser.php @@ -0,0 +1,10 @@ +browse(function (Browser $browser) { + $browser->visit('/{name}') + ->assertSee('{name}'); + }); +}); From d693d9937965bb77e94600fc0532475e05b45e5b Mon Sep 17 00:00:00 2001 From: Gerardo Ibarra Date: Mon, 28 Dec 2020 13:51:03 -0300 Subject: [PATCH 2/2] Update src/Laravel/Commands/PestTestCommand.php Co-authored-by: Owen Voke --- src/Laravel/Commands/PestTestCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Laravel/Commands/PestTestCommand.php b/src/Laravel/Commands/PestTestCommand.php index 32650161..142e20da 100644 --- a/src/Laravel/Commands/PestTestCommand.php +++ b/src/Laravel/Commands/PestTestCommand.php @@ -19,7 +19,7 @@ final class PestTestCommand extends Command * * @var string */ - protected $signature = 'pest:test {name : The name of the file} {--unit : Create a unit test} {--dusk : Create a dusk test}'; + protected $signature = 'pest:test {name : The name of the file} {--unit : Create a unit test} {--dusk : Create a Dusk test}'; /** * The console command description.