@@ -101,7 +101,9 @@ public function handle()
101
101
$ stubs = $ this ->getTestStubsPath ();
102
102
103
103
if ($ this ->option ('pest ' )) {
104
- if ($ this ->requireComposerDevPackages ('pestphp/pest:^1.16 ' , 'pestphp/pest-plugin-laravel:^1.1 ' )) {
104
+ $ this ->removeComposerDevPackages (['nunomaduro/collision ' , 'phpunit/phpunit ' ]);
105
+
106
+ if (! $ this ->requireComposerDevPackages (['nunomaduro/collision:^6.4 ' , 'pestphp/pest:^1.22 ' , 'pestphp/pest-plugin-laravel:^1.2 ' ])) {
105
107
return 1 ;
106
108
}
107
109
@@ -670,6 +672,32 @@ protected function requireComposerPackages($packages)
670
672
});
671
673
}
672
674
675
+ /**
676
+ * Removes the given Composer Packages as "dev" dependencies.
677
+ *
678
+ * @param mixed $packages
679
+ * @return bool
680
+ */
681
+ protected function removeComposerDevPackages ($ packages )
682
+ {
683
+ $ composer = $ this ->option ('composer ' );
684
+
685
+ if ($ composer !== 'global ' ) {
686
+ $ command = [$ this ->phpBinary (), $ composer , 'remove ' , '--dev ' ];
687
+ }
688
+
689
+ $ command = array_merge (
690
+ $ command ?? ['composer ' , 'remove ' , '--dev ' ],
691
+ is_array ($ packages ) ? $ packages : func_get_args ()
692
+ );
693
+
694
+ return (new Process ($ command , base_path (), ['COMPOSER_MEMORY_LIMIT ' => '-1 ' ]))
695
+ ->setTimeout (null )
696
+ ->run (function ($ type , $ output ) {
697
+ $ this ->output ->write ($ output );
698
+ }) === 0 ;
699
+ }
700
+
673
701
/**
674
702
* Install the given Composer Packages as "dev" dependencies.
675
703
*
@@ -689,11 +717,11 @@ protected function requireComposerDevPackages($packages)
689
717
is_array ($ packages ) ? $ packages : func_get_args ()
690
718
);
691
719
692
- return ! (new Process ($ command , base_path (), ['COMPOSER_MEMORY_LIMIT ' => '-1 ' ]))
720
+ return (new Process ($ command , base_path (), ['COMPOSER_MEMORY_LIMIT ' => '-1 ' ]))
693
721
->setTimeout (null )
694
722
->run (function ($ type , $ output ) {
695
723
$ this ->output ->write ($ output );
696
- });
724
+ }) === 0 ;
697
725
}
698
726
699
727
/**
0 commit comments