@@ -95,7 +95,9 @@ public function handle()
95
95
$ stubs = $ this ->getTestStubsPath ();
96
96
97
97
if ($ this ->option ('pest ' )) {
98
- if (! $ this ->requireComposerDevPackages ('pestphp/pest:^1.22 ' , 'pestphp/pest-plugin-laravel:^1.4 ' )) {
98
+ $ this ->removeComposerDevPackages (['nunomaduro/collision ' , 'phpunit/phpunit ' ]);
99
+
100
+ if (! $ this ->requireComposerDevPackages (['nunomaduro/collision:^6.4 ' , 'pestphp/pest:^1.22 ' , 'pestphp/pest-plugin-laravel:^1.2 ' ])) {
99
101
return 1 ;
100
102
}
101
103
@@ -644,6 +646,32 @@ protected function requireComposerPackages($packages)
644
646
});
645
647
}
646
648
649
+ /**
650
+ * Removes the given Composer Packages as "dev" dependencies.
651
+ *
652
+ * @param mixed $packages
653
+ * @return bool
654
+ */
655
+ protected function removeComposerDevPackages ($ packages )
656
+ {
657
+ $ composer = $ this ->option ('composer ' );
658
+
659
+ if ($ composer !== 'global ' ) {
660
+ $ command = [$ this ->phpBinary (), $ composer , 'remove ' , '--dev ' ];
661
+ }
662
+
663
+ $ command = array_merge (
664
+ $ command ?? ['composer ' , 'remove ' , '--dev ' ],
665
+ is_array ($ packages ) ? $ packages : func_get_args ()
666
+ );
667
+
668
+ return (new Process ($ command , base_path (), ['COMPOSER_MEMORY_LIMIT ' => '-1 ' ]))
669
+ ->setTimeout (null )
670
+ ->run (function ($ type , $ output ) {
671
+ $ this ->output ->write ($ output );
672
+ }) === 0 ;
673
+ }
674
+
647
675
/**
648
676
* Install the given Composer Packages as "dev" dependencies.
649
677
*
0 commit comments