createMock(Command::class); $command->method('getName')->willReturn($name); $command->method('isEnabled')->willReturn(true); $command->method('getAliases')->willReturn([]); $command->method('getDefinition')->willReturn(new InputDefinition()); $command->method('setApplication')->with(Assert::isInstanceOf(Application::class)); return $command; } private function testerForCommand(Command $mainCommand, Command ...$extraCommands): CommandTester { $app = new Application(); $app->add($mainCommand); foreach ($extraCommands as $command) { $app->add($command); } return new CommandTester($mainCommand); } }