testDouble( Command::class, mockObject: true, callOriginalConstructor: false, callOriginalClone: false, cloneArguments: false, allowMockingUnknownTypes: false, ); $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; } public static function testerForCommand(Command $mainCommand, Command ...$extraCommands): CommandTester { $app = new Application(); $app->add($mainCommand); foreach ($extraCommands as $command) { $app->add($command); } return new CommandTester($mainCommand); } }