Skip to content

Commit adda1ac

Browse files
[2.x] Install pest as devDependency (#1040)
* feat: install pest as a dev dependency * Update InstallCommand.php Co-authored-by: Taylor Otwell <[email protected]>
1 parent ccfe851 commit adda1ac

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/Console/InstallCommand.php

+27-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function handle()
6969
$stubs = $this->getTestStubsPath();
7070

7171
if ($this->option('pest')) {
72-
$this->requireComposerPackages('pestphp/pest:^1.16', 'pestphp/pest-plugin-laravel:^1.1');
72+
$this->requireComposerDevPackages('pestphp/pest:^1.16', 'pestphp/pest-plugin-laravel:^1.1');
7373

7474
copy($stubs.'/Pest.php', base_path('tests/Pest.php'));
7575
copy($stubs.'/ExampleTest.php', base_path('tests/Feature/ExampleTest.php'));
@@ -603,6 +603,32 @@ protected function requireComposerPackages($packages)
603603
});
604604
}
605605

606+
/**
607+
* Install the given Composer Packages as "dev" dependencies.
608+
*
609+
* @param mixed $packages
610+
* @return void
611+
*/
612+
protected function requireComposerDevPackages($packages)
613+
{
614+
$composer = $this->option('composer');
615+
616+
if ($composer !== 'global') {
617+
$command = [$this->phpBinary(), $composer, 'require', '--dev'];
618+
}
619+
620+
$command = array_merge(
621+
$command ?? ['composer', 'require', '--dev'],
622+
is_array($packages) ? $packages : func_get_args()
623+
);
624+
625+
(new Process($command, base_path(), ['COMPOSER_MEMORY_LIMIT' => '-1']))
626+
->setTimeout(null)
627+
->run(function ($type, $output) {
628+
$this->output->write($output);
629+
});
630+
}
631+
606632
/**
607633
* Update the "package.json" file.
608634
*

0 commit comments

Comments
 (0)