public function testGetFormatterOptions() { $formatter1 = $this->prophesize(OutputFormatterInterface::class); $formatter1->getName()->willReturn('foo1'); $formatter1->configureOptions()->willReturn([OutputFormatterOption::newValueOption('f1-n1', 'f1-n1-desc', 'f1-n1-default')]); $formatter2 = $this->prophesize(OutputFormatterInterface::class); $formatter2->getName()->willReturn('foo2'); $formatter2->configureOptions()->willReturn([OutputFormatterOption::newValueOption('f2-n1', 'f2-n1-desc', 'f2-n1-default'), OutputFormatterOption::newValueOption('f2-n2', 'f2-n2-desc', 'f2-n2-default')]); $formatter3 = $this->prophesize(OutputFormatterInterface::class); $formatter3->getName()->willReturn('foo3'); $formatter3->configureOptions()->willReturn([]); $formatterFactory = new OutputFormatterFactory([$formatter1->reveal(), $formatter2->reveal(), $formatter3->reveal()]); /** @var $arguments InputArgument[] */ $arguments = $formatterFactory->getFormatterOptions('foo1'); $this->assertEquals('formatter-foo1', $arguments[0]->getName()); $this->assertEquals('formatter-foo1-f1-n1', $arguments[1]->getName()); $this->assertEquals('f1-n1-default', $arguments[1]->getDefault()); $this->assertEquals('f1-n1-desc', $arguments[1]->getDescription()); $this->assertEquals('formatter-foo2', $arguments[2]->getName()); $this->assertEquals('formatter-foo2-f2-n1', $arguments[3]->getName()); $this->assertEquals('f2-n1-default', $arguments[3]->getDefault()); $this->assertEquals('f2-n1-desc', $arguments[3]->getDescription()); $this->assertEquals('formatter-foo2-f2-n2', $arguments[4]->getName()); $this->assertEquals('f2-n2-default', $arguments[4]->getDefault()); $this->assertEquals('f2-n2-desc', $arguments[4]->getDescription()); $this->assertCount(6, $arguments); }
public function testGetSet() { $formatterOption = OutputFormatterOption::newValueOption('name', 'desc', 'default'); $this->assertEquals('name', $formatterOption->getName()); $this->assertEquals(4, $formatterOption->getMode()); $this->assertEquals('desc', $formatterOption->getDescription()); $this->assertEquals('default', $formatterOption->getDefault()); }
/** * @return OutputFormatterOption[] */ public function configureOptions() { return [OutputFormatterOption::newValueOption(static::$argument_display, 'should try to open graphviz image', true), OutputFormatterOption::newValueOption(static::$argument_dump_image, 'path to a dumped png file', ''), OutputFormatterOption::newValueOption(static::$argument_dump_dot, 'path to a dumped dot file', ''), OutputFormatterOption::newValueOption(static::$argument_dump_html, 'path to a dumped html file', '')]; }