Skip to content

Commit

Permalink
Fixes installation of pest on vue/react stacks (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro authored Aug 31, 2021
1 parent b7b505f commit 2d670b2
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,7 @@ public function handle()
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/App/View/Components', app_path('View/Components'));

// Tests...
if ($this->option('pest')) {
$this->requireComposerPackages('pestphp/pest:^1.16', 'pestphp/pest-plugin-laravel:^1.1');

(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/pest-tests/Feature', base_path('tests/Feature'));
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/pest-tests/Unit', base_path('tests/Unit'));
(new Filesystem)->copy(__DIR__.'/../../stubs/default/pest-tests/Pest.php', base_path('tests/Pest.php'));
} else {
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/tests/Feature', base_path('tests/Feature'));
}
$this->installTests();

// Routes...
copy(__DIR__.'/../../stubs/default/routes/web.php', base_path('routes/web.php'));
Expand All @@ -106,6 +98,24 @@ public function handle()
$this->comment('Please execute the "npm install && npm run dev" command to build your assets.');
}

/**
* Install Breeze's tests.
*
* @return void
*/
protected function installTests()
{
if ($this->option('pest')) {
$this->requireComposerPackages('pestphp/pest:^1.16', 'pestphp/pest-plugin-laravel:^1.1');

(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/pest-tests/Feature', base_path('tests/Feature'));
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/pest-tests/Unit', base_path('tests/Unit'));
(new Filesystem)->copy(__DIR__.'/../../stubs/default/pest-tests/Pest.php', base_path('tests/Pest.php'));
} else {
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/tests/Feature', base_path('tests/Feature'));
}
}

/**
* Install the Inertia Vue Breeze stack.
*
Expand Down Expand Up @@ -159,7 +169,7 @@ protected function installInertiaVueStack()
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/inertia-vue/resources/js/Pages', resource_path('js/Pages'));

// Tests...
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/tests/Feature', base_path('tests/Feature'));
$this->installTests();

// Routes...
copy(__DIR__.'/../../stubs/inertia-common/routes/web.php', base_path('routes/web.php'));
Expand Down Expand Up @@ -236,7 +246,7 @@ protected function installInertiaReactStack()
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/inertia-react/resources/js/Pages', resource_path('js/Pages'));

// Tests...
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/tests/Feature', base_path('tests/Feature'));
$this->installTests();

// Routes...
copy(__DIR__.'/../../stubs/inertia-common/routes/web.php', base_path('routes/web.php'));
Expand Down

0 comments on commit 2d670b2

Please sign in to comment.