@@ -121,7 +121,7 @@ public function executeWillReturnSuccessWhenPreviewAndAnalyzersSucceed(): void
121121 ->shouldBeCalledOnce ();
122122 $ this ->processQueue ->add ($ this ->processDepAnalyser ->reveal ())
123123 ->shouldBeCalledOnce ();
124- $ this ->processQueue ->add ($ this ->processBreakpoint ->reveal ())
124+ $ this ->processQueue ->add ($ this ->processBreakpoint ->reveal (), false )
125125 ->shouldBeCalledOnce ();
126126 $ this ->processQueue ->run ($ this ->output ->reveal ())
127127 ->willReturn (ProcessQueueInterface::SUCCESS )
@@ -148,7 +148,7 @@ public function executeWillReturnFailureWhenProcessQueueFails(): void
148148 ->shouldBeCalledOnce ();
149149 $ this ->processQueue ->add ($ this ->processDepAnalyser ->reveal ())
150150 ->shouldBeCalledOnce ();
151- $ this ->processQueue ->add ($ this ->processBreakpoint ->reveal ())
151+ $ this ->processQueue ->add ($ this ->processBreakpoint ->reveal (), false )
152152 ->shouldBeCalledOnce ();
153153 $ this ->processQueue ->run ($ this ->output ->reveal ())
154154 ->willReturn (ProcessQueueInterface::FAILURE )
@@ -179,7 +179,7 @@ public function executeWillQueueUpgradeWorkflowBeforeAnalysisWhenUpgradeIsReques
179179 ->shouldBeCalledOnce ();
180180 $ this ->processQueue ->add ($ this ->processDepAnalyser ->reveal ())
181181 ->shouldBeCalledOnce ();
182- $ this ->processQueue ->add ($ this ->processBreakpoint ->reveal ())
182+ $ this ->processQueue ->add ($ this ->processBreakpoint ->reveal (), false )
183183 ->shouldBeCalledOnce ();
184184 $ this ->processQueue ->run ($ this ->output ->reveal ())
185185 ->willReturn (ProcessQueueInterface::SUCCESS )
@@ -206,6 +206,21 @@ public function executeWillFailWhenMaxOutdatedIsNotNumeric(): void
206206 self ::assertSame (DependenciesCommand::FAILURE , $ this ->executeCommand ());
207207 }
208208
209+ /**
210+ * @return void
211+ */
212+ #[Test]
213+ public function executeWillFailWhenMaxOutdatedIsLowerThanMinusOne (): void
214+ {
215+ $ this ->input ->getOption ('max-outdated ' )
216+ ->willReturn ('-2 ' );
217+ $ this ->output ->writeln ('<error>The --max-outdated option MUST be -1 or greater.</error> ' )
218+ ->shouldBeCalledOnce ();
219+ $ this ->processQueue ->run (Argument::cetera ())->shouldNotBeCalled ();
220+
221+ self ::assertSame (DependenciesCommand::FAILURE , $ this ->executeCommand ());
222+ }
223+
209224 /**
210225 * @return void
211226 */
@@ -221,7 +236,34 @@ public function executeWillDumpPackageUsagesAndShowAllMatchesWhenRequested(): vo
221236 ->shouldBeCalledOnce ();
222237 $ this ->processQueue ->add ($ this ->processDepAnalyser ->reveal ())
223238 ->shouldBeCalledOnce ();
224- $ this ->processQueue ->add ($ this ->processBreakpoint ->reveal ())
239+ $ this ->processQueue ->add ($ this ->processBreakpoint ->reveal (), false )
240+ ->shouldBeCalledOnce ();
241+ $ this ->processQueue ->run ($ this ->output ->reveal ())
242+ ->willReturn (ProcessQueueInterface::SUCCESS )
243+ ->shouldBeCalledOnce ();
244+
245+ $ this ->output ->writeln ('<info>Running dependency analysis...</info> ' )
246+ ->shouldBeCalledOnce ();
247+
248+ self ::assertSame (DependenciesCommand::SUCCESS , $ this ->executeCommand ());
249+ }
250+
251+ /**
252+ * @return void
253+ */
254+ #[Test]
255+ public function executeWillIgnoreJackFailuresWhenMaxOutdatedIsDisabled (): void
256+ {
257+ $ this ->configureBaseExecution (maxOutdated: '-1 ' , upgrade: false , dev: false , dumpUsage: null );
258+ $ this ->configurePreviewBuilders (dev: false , maxOutdated: '-1 ' , dumpUsage: null );
259+
260+ $ this ->processQueue ->add ($ this ->processRaiseToInstalled ->reveal ())
261+ ->shouldBeCalledOnce ();
262+ $ this ->processQueue ->add ($ this ->processOpenVersions ->reveal ())
263+ ->shouldBeCalledOnce ();
264+ $ this ->processQueue ->add ($ this ->processDepAnalyser ->reveal ())
265+ ->shouldBeCalledOnce ();
266+ $ this ->processQueue ->add ($ this ->processBreakpoint ->reveal (), true )
225267 ->shouldBeCalledOnce ();
226268 $ this ->processQueue ->run ($ this ->output ->reveal ())
227269 ->willReturn (ProcessQueueInterface::SUCCESS )
@@ -291,7 +333,11 @@ private function configurePreviewBuilders(bool $dev, string $maxOutdated, ?strin
291333 ->willReturn ($ this ->processDepAnalyser ->reveal ());
292334 $ this ->processBuilder
293335 ->build (
294- $ dev ? 'vendor/bin/jack breakpoint --dev --limit ' . $ maxOutdated : 'vendor/bin/jack breakpoint --limit ' . $ maxOutdated
336+ '-1 ' === $ maxOutdated
337+ ? ($ dev ? 'vendor/bin/jack breakpoint --dev ' : 'vendor/bin/jack breakpoint ' )
338+ : ($ dev
339+ ? 'vendor/bin/jack breakpoint --dev --limit ' . $ maxOutdated
340+ : 'vendor/bin/jack breakpoint --limit ' . $ maxOutdated )
295341 )
296342 ->willReturn ($ this ->processBreakpoint ->reveal ());
297343 }
@@ -345,7 +391,11 @@ private function configureUpgradeBuilders(bool $dev, string $maxOutdated, ?strin
345391 ->willReturn ($ this ->processDepAnalyser ->reveal ());
346392 $ this ->processBuilder
347393 ->build (
348- $ dev ? 'vendor/bin/jack breakpoint --dev --limit ' . $ maxOutdated : 'vendor/bin/jack breakpoint --limit ' . $ maxOutdated
394+ '-1 ' === $ maxOutdated
395+ ? ($ dev ? 'vendor/bin/jack breakpoint --dev ' : 'vendor/bin/jack breakpoint ' )
396+ : ($ dev
397+ ? 'vendor/bin/jack breakpoint --dev --limit ' . $ maxOutdated
398+ : 'vendor/bin/jack breakpoint --limit ' . $ maxOutdated )
349399 )
350400 ->willReturn ($ this ->processBreakpoint ->reveal ());
351401 }
0 commit comments