X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fconsolidation%2Fannotated-command%2Ftests%2Fsrc%2Falpha%2FAlphaCommandFile.php;fp=vendor%2Fconsolidation%2Fannotated-command%2Ftests%2Fsrc%2Falpha%2FAlphaCommandFile.php;h=651b8533d02afe1633cd1f80dbb36410f6de37cd;hp=b5d06eca63717d4f0b3b4cf85e109472a16e240b;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/consolidation/annotated-command/tests/src/alpha/AlphaCommandFile.php b/vendor/consolidation/annotated-command/tests/src/alpha/AlphaCommandFile.php index b5d06eca6..651b8533d 100644 --- a/vendor/consolidation/annotated-command/tests/src/alpha/AlphaCommandFile.php +++ b/vendor/consolidation/annotated-command/tests/src/alpha/AlphaCommandFile.php @@ -9,6 +9,9 @@ use Symfony\Component\Console\Input\InputOption; use Consolidation\AnnotatedCommand\CommandData; use Consolidation\AnnotatedCommand\Events\CustomEventAwareInterface; use Consolidation\AnnotatedCommand\Events\CustomEventAwareTrait; +use Symfony\Component\Console\Command\Command; + +use Consolidation\TestUtils\ExampleCommandFile as ExampleAliasedClass; /** * Test file used in the testCommandDiscovery() test. @@ -29,6 +32,11 @@ class AlphaCommandFile implements CustomEventAwareInterface return new CommandError('This command always fails.', 13); } + public static function ignoredStaticMethod() + { + return 'This method is static; it should not generate a command.'; + } + /** * @command simulated:status */ @@ -89,7 +97,7 @@ class AlphaCommandFile implements CustomEventAwareInterface * Note that either the field ID or the visible field label may be used. * @aliases extab * @topics docs-tables - * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields + * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields Fully-qualified class name */ public function exampleTable($unused = '', $options = ['format' => 'table', 'fields' => '']) { @@ -102,6 +110,36 @@ class AlphaCommandFile implements CustomEventAwareInterface return new RowsOfFields($outputData); } + /** + * Test command with formatters using a short classname in @return + * + * @command example:table2 + * @param $unused An unused argument + * @field-labels + * first: I + * second: II + * third: III + * @usage example:table --format=yml + * Show the example table in yml format. + * @usage example:table --fields=first,third + * Show only the first and third fields in the table. + * @usage example:table --fields=II,III + * Note that either the field ID or the visible field label may be used. + * @aliases extab + * @topics docs-tables + * @return RowsOfFields Short class names are converted to fqcns + */ + public function exampleTableTwo($unused = '', $options = ['format' => 'table', 'fields' => '']) + { + $outputData = [ + [ 'first' => 'One', 'second' => 'Two', 'third' => 'Three' ], + [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei' ], + [ 'first' => 'Ichi', 'second' => 'Ni', 'third' => 'San' ], + [ 'first' => 'Uno', 'second' => 'Dos', 'third' => 'Tres' ], + ]; + return new RowsOfFields($outputData); + } + /** * Test word wrapping * @@ -126,7 +164,7 @@ class AlphaCommandFile implements CustomEventAwareInterface /** * @hook option example:table */ - public function additionalOptionForExampleTable($command, $annotationData) + public function additionalOptionForExampleTable(Command $command, AnnotationData $annotationData) { $command->addOption( 'dynamic',