Skip to content

Commit

Permalink
[8.x] Adds --pest option when using the make:test artisan command (
Browse files Browse the repository at this point in the history
…#38966)

* Adds `--pest` as an option when using the `make:test` command.

* Adds `--pest` as an option when using the `make:test` command.
  • Loading branch information
lukeraymonddowning authored Sep 27, 2021
1 parent 14e959c commit 02da36c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Illuminate/Foundation/Console/TestMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ class TestMakeCommand extends GeneratorCommand
*/
protected function getStub()
{
return $this->option('unit')
? $this->resolveStubPath('/stubs/test.unit.stub')
: $this->resolveStubPath('/stubs/test.stub');
$suffix = $this->option('unit') ? '.unit.stub' : '.stub';

return $this->option('pest')
? $this->resolveStubPath('/stubs/pest'.$suffix)
: $this->resolveStubPath('/stubs/test'.$suffix);
}

/**
Expand Down Expand Up @@ -101,6 +103,7 @@ protected function getOptions()
{
return [
['unit', 'u', InputOption::VALUE_NONE, 'Create a unit test.'],
['pest', 'p', InputOption::VALUE_NONE, 'Create a Pest test.'],
];
}
}
7 changes: 7 additions & 0 deletions src/Illuminate/Foundation/Console/stubs/pest.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

test('example', function () {
$response = $this->get('/');

$response->assertStatus(200);
});
5 changes: 5 additions & 0 deletions src/Illuminate/Foundation/Console/stubs/pest.unit.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

test('example', function () {
expect(true)->toBeTrue();
});

0 comments on commit 02da36c

Please sign in to comment.