diff --git a/src/Laravel/Commands/PestInstallCommand.php b/src/Laravel/Commands/PestInstallCommand.php index b1f34a45..a627a4df 100644 --- a/src/Laravel/Commands/PestInstallCommand.php +++ b/src/Laravel/Commands/PestInstallCommand.php @@ -36,14 +36,10 @@ final class PestInstallCommand extends Command { /* @phpstan-ignore-next-line */ $pest = base_path('tests/Pest.php'); - /* @phpstan-ignore-next-line */ - $helpers = base_path('tests/Helpers.php'); - $stubs = $this->isLumen() ? 'stubs/Lumen' : 'stubs/Laravel'; + $stubs = 'stubs/Laravel'; - foreach ([$pest, $helpers] as $file) { - if (File::exists($file)) { - throw new InvalidConsoleArgument(sprintf('%s already exist', $file)); - } + if (File::exists($pest)) { + throw new InvalidConsoleArgument(sprintf('%s already exist', $pest)); } File::copy(implode(DIRECTORY_SEPARATOR, [ @@ -52,14 +48,7 @@ final class PestInstallCommand extends Command 'Pest.php', ]), $pest); - File::copy(implode(DIRECTORY_SEPARATOR, [ - dirname(__DIR__, 3), - $stubs, - 'Helpers.php', - ]), $helpers); - $this->output->success('`tests/Pest.php` created successfully.'); - $this->output->success('`tests/Helpers.php` created successfully.'); if (!(bool) $this->option('no-interaction')) { (new Thanks($this->output))(); diff --git a/stubs/Laravel/Helpers.php b/stubs/Laravel/Helpers.php deleted file mode 100644 index cbd31f2a..00000000 --- a/stubs/Laravel/Helpers.php +++ /dev/null @@ -1,11 +0,0 @@ -assertTrue(true); -} diff --git a/stubs/Laravel/Pest.php b/stubs/Laravel/Pest.php index a7b28ca8..757481aa 100644 --- a/stubs/Laravel/Pest.php +++ b/stubs/Laravel/Pest.php @@ -1,3 +1,44 @@ in('Feature'); + +/* +|-------------------------------------------------------------------------- +| Expectations +|-------------------------------------------------------------------------- +| +| When you're writing tests, you often need to check that values meet certain conditions. The +| "expect()" function gives you access to a set of "expectations" methods that you can use +| to assert different things. Of course, you may extend the Expectation API at any time. +| +*/ + +expect()->extend('toBeOne', function () { + return $this->toBe(1); +}); + +/* +|-------------------------------------------------------------------------- +| Functions +|-------------------------------------------------------------------------- +| +| While Pest is very powerful out-of-the-box, you may have some testing code specific to your +| project that you don't want to repeat in every file. Here you can also expose helpers as +| global functions to help you to reduce the number of lines of code in your test files. +| +*/ + +function something() { + // .. +}); diff --git a/stubs/Lumen/Helpers.php b/stubs/Lumen/Helpers.php deleted file mode 100644 index cbd31f2a..00000000 --- a/stubs/Lumen/Helpers.php +++ /dev/null @@ -1,11 +0,0 @@ -assertTrue(true); -} diff --git a/stubs/Lumen/Pest.php b/stubs/Lumen/Pest.php deleted file mode 100644 index 937ef889..00000000 --- a/stubs/Lumen/Pest.php +++ /dev/null @@ -1,3 +0,0 @@ -in(__DIR__); diff --git a/stubs/Lumen/phpunit.xml b/stubs/Lumen/phpunit.xml deleted file mode 100644 index 4dbf41f1..00000000 --- a/stubs/Lumen/phpunit.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - ./tests - - - - - ./app - - -