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()); }
public function __construct($name = null) { $commandInfo = false; // If this is a subclass of AnnotatedCommand, check to see // if the 'execute' method is annotated. We could do this // unconditionally; it is a performance optimization to skip // checking the annotations if $this is an instance of // AnnotatedCommand. Alternately, we break out a new subclass. // The command factory instantiates the subclass. if (get_class($this) != 'Consolidation\\AnnotatedCommand\\AnnotatedCommand') { $commandInfo = new CommandInfo($this, 'execute'); if (!isset($name)) { $name = $commandInfo->getName(); } } parent::__construct($name); if ($commandInfo && $commandInfo->hasAnnotation('command')) { $this->setCommandInfo($commandInfo); $this->setCommandOptions($commandInfo); } }
function testReturnValue() { $commandInfo = new CommandInfo('\\Consolidation\\TestUtils\\alpha\\AlphaCommandFile', 'exampleTable'); $this->assertEquals('example:table', $commandInfo->getName()); $this->assertEquals('\\Consolidation\\OutputFormatters\\StructuredData\\RowsOfFields', $commandInfo->getReturnType()); }