function testValidFormats() { $formatter = new FormatterManager(); $formatter->addDefaultFormatters(); $formatter->addDefaultSimplifiers(); $commandInfo = new CommandInfo('\\Consolidation\\TestUtils\\alpha\\AlphaCommandFile', 'exampleTable'); $this->assertEquals('example:table', $commandInfo->getName()); $this->assertEquals('\\Consolidation\\OutputFormatters\\StructuredData\\RowsOfFields', $commandInfo->getReturnType()); }
/** * Get the options that are implied by annotations, e.g. @fields implies * that there should be a --fields and a --format option. * * @return InputOption[] */ public function automaticOptions(CommandInfo $commandInfo) { $automaticOptions = []; $formatManager = $this->commandProcessor()->formatterManager(); if ($formatManager) { $annotationData = $commandInfo->getAnnotations()->getArrayCopy(); $formatterOptions = new FormatterOptions($annotationData); $dataType = $commandInfo->getReturnType(); $automaticOptions = $formatManager->automaticOptions($formatterOptions, $dataType); } return $automaticOptions; }
function testReturnValue() { $commandInfo = new CommandInfo('\\Consolidation\\TestUtils\\alpha\\AlphaCommandFile', 'exampleTable'); $this->assertEquals('example:table', $commandInfo->getName()); $this->assertEquals('\\Consolidation\\OutputFormatters\\StructuredData\\RowsOfFields', $commandInfo->getReturnType()); }