diff --git a/packages/console/Command/GenerateDocumentationCommand.php b/packages/console/Command/GenerateDocumentationCommand.php index 22b08ce5..b73e6c0f 100644 --- a/packages/console/Command/GenerateDocumentationCommand.php +++ b/packages/console/Command/GenerateDocumentationCommand.php @@ -30,7 +30,7 @@ protected function configure(): void $this ->setDescription('Generate a documentation for all the command of the application.') ->addArgument('path', InputArgument::REQUIRED, 'The path where the documentation will be generated.') - ->addOption('format', null, InputArgument::OPTIONAL, 'The format of the documentation (txt|md|json|xml).', 'txt'); + ->addOption('format', 'f', InputArgument::OPTIONAL, 'The format of the documentation (txt|md|json|xml).', 'txt'); } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/packages/tester/Application/CommandTestTrait.php b/packages/tester/Application/CommandTestTrait.php index 169feb70..a402d47c 100644 --- a/packages/tester/Application/CommandTestTrait.php +++ b/packages/tester/Application/CommandTestTrait.php @@ -152,6 +152,10 @@ public function testOptions(): void $definition = $command->getDefinition(); $realCommandOptions = []; foreach ($definition->getOptions() as $option) { + if (null !== $shortcut = $option->getShortcut()) { + TestCase::assertEquals(1, \strlen($shortcut)); + } + $realCommandOptions[$option->getName()] = $option; } diff --git a/tests/Console/Command/GenerateDocumentationCommandTest.php b/tests/Console/Command/GenerateDocumentationCommandTest.php index 4dbc15bd..202e350d 100644 --- a/tests/Console/Command/GenerateDocumentationCommandTest.php +++ b/tests/Console/Command/GenerateDocumentationCommandTest.php @@ -40,7 +40,7 @@ public static function provideTestOption(): iterable { yield [ 'format', - null, + 'f', InputOption::VALUE_REQUIRED, 'txt', ]; @@ -58,7 +58,7 @@ function () use ($filePath): void { } ); - $this->execute(['path' => $filePath]) + $this->execute(['path' => $filePath, '-f' => 'txt']) ->test( CommandDataTester::create() ->setExpectedDisplay([ diff --git a/tests/Console/Command/fixtures/GenerateDocumentationCommandTest/testExecution_expectedExport.txt b/tests/Console/Command/fixtures/GenerateDocumentationCommandTest/testExecution_expectedExport.txt index da62aadd..2e803a93 100644 --- a/tests/Console/Command/fixtures/GenerateDocumentationCommandTest/testExecution_expectedExport.txt +++ b/tests/Console/Command/fixtures/GenerateDocumentationCommandTest/testExecution_expectedExport.txt @@ -11,7 +11,7 @@ Arguments: path The path where the documentation will be generated. Options: - --format=FORMAT The format of the documentation (txt|md|json|xml). [default: "txt"] + -f, --format=FORMAT The format of the documentation (txt|md|json|xml). [default: "txt"] --aws-newest-instance-role=AWS-NEWEST-INSTANCE-ROLE The instance role the server must be the newest of to run the command. --draw-execution-id=DRAW-EXECUTION-ID The existing execution id of the command. Use internally by the DrawCommandBundle. --draw-execution-ignore Flag to ignore login of the execution to the databases.