@@ -594,28 +594,30 @@ protected function validateStackOption(InputInterface $input)
594594 */
595595 protected function installPest (string $ directory , InputInterface $ input , OutputInterface $ output )
596596 {
597- if ($ this ->removeComposerPackages (['phpunit/phpunit ' , '--no-update ' ], $ output , true )
598- && $ this ->requireComposerPackages (['pestphp/pest:^2.0 ' , 'pestphp/pest-plugin-laravel:^2.0 ' ], $ output , true )) {
599- $ commands = array_filter ([
600- $ this ->phpBinary ().' ./vendor/bin/pest --init ' ,
601- ]);
602-
603- $ this ->runCommands ($ commands , $ input , $ output , workingPath: $ directory , env: [
604- 'PEST_NO_SUPPORT ' => 'true ' ,
605- ]);
606-
607- $ this ->replaceFile (
608- 'pest/Feature.php ' ,
609- $ directory .'/tests/Feature/ExampleTest.php ' ,
610- );
597+ $ composerBinary = $ this ->findComposer ();
611598
612- $ this ->replaceFile (
613- 'pest/Unit.php ' ,
614- $ directory .'/tests/Unit/ExampleTest.php ' ,
615- );
599+ $ commands = [
600+ $ composerBinary .' remove phpunit/phpunit --dev --no-update ' ,
601+ $ composerBinary .' require pestphp/pest:^2.0 pestphp/pest-plugin-laravel:^2.0 --no-update --dev ' ,
602+ $ composerBinary .' update ' ,
603+ $ this ->phpBinary ().' ./vendor/bin/pest --init ' ,
604+ ];
616605
617- $ this ->commitChanges ('Install Pest ' , $ directory , $ input , $ output );
618- }
606+ $ this ->runCommands ($ commands , $ input , $ output , workingPath: $ directory , env: [
607+ 'PEST_NO_SUPPORT ' => 'true ' ,
608+ ]);
609+
610+ $ this ->replaceFile (
611+ 'pest/Feature.php ' ,
612+ $ directory .'/tests/Feature/ExampleTest.php ' ,
613+ );
614+
615+ $ this ->replaceFile (
616+ 'pest/Unit.php ' ,
617+ $ directory .'/tests/Unit/ExampleTest.php ' ,
618+ );
619+
620+ $ this ->commitChanges ('Install Pest ' , $ directory , $ input , $ output );
619621 }
620622
621623 /**
@@ -769,26 +771,6 @@ protected function phpBinary()
769771 : 'php ' ;
770772 }
771773
772- /**
773- * Install the given Composer Packages into the application.
774- *
775- * @return bool
776- */
777- protected function requireComposerPackages (array $ packages , OutputInterface $ output , bool $ asDev = false )
778- {
779- return $ this ->composer ->requirePackages ($ packages , $ asDev , $ output );
780- }
781-
782- /**
783- * Remove the given Composer Packages from the application.
784- *
785- * @return bool
786- */
787- protected function removeComposerPackages (array $ packages , OutputInterface $ output , bool $ asDev = false )
788- {
789- return $ this ->composer ->removePackages ($ packages , $ asDev , $ output );
790- }
791-
792774 /**
793775 * Run the given commands.
794776 *
0 commit comments