@@ -304,7 +304,12 @@ public function testComplete(array $input, array $expectedSuggestions)
304304 $ environment = new Environment ($ loader );
305305
306306 $ application = new Application ();
307- $ application ->add (new DebugCommand ($ environment , $ projectDir , [], null , null ));
307+ $ command = new DebugCommand ($ environment , $ projectDir , [], null , null );
308+ if (method_exists ($ application , 'addCommand ' )) {
309+ $ application ->addCommand ($ command );
310+ } else {
311+ $ application ->add ($ command );
312+ }
308313
309314 $ tester = new CommandCompletionTester ($ application ->find ('debug:twig ' ));
310315 $ suggestions = $ tester ->complete ($ input , 2 );
@@ -339,7 +344,12 @@ private function createCommandTester(array $paths = [], array $bundleMetadata =
339344 }
340345
341346 $ application = new Application ();
342- $ application ->add (new DebugCommand ($ environment , $ projectDir , $ bundleMetadata , $ defaultPath , null ));
347+ $ command = new DebugCommand ($ environment , $ projectDir , $ bundleMetadata , $ defaultPath , null );
348+ if (method_exists ($ application , 'addCommand ' )) {
349+ $ application ->addCommand ($ command );
350+ } else {
351+ $ application ->add ($ command );
352+ }
343353 $ command = $ application ->find ('debug:twig ' );
344354
345355 return new CommandTester ($ command );
0 commit comments