Example #1
0
 public function testInheritApplicationArgsFormat()
 {
     $baseFormat = ArgsFormat::build()->addArgument(new Argument('global-argument'))->addOption(new Option('global-option'))->getFormat();
     $this->application->expects($this->any())->method('getGlobalArgsFormat')->willReturn($baseFormat);
     $config = new CommandConfig('command');
     $config->addArgument('argument');
     $config->addOption('option');
     $command = new Command($config, $this->application);
     $argsFormat = $command->getArgsFormat();
     $this->assertSame($baseFormat, $argsFormat->getBaseFormat());
     $this->assertCount(2, $argsFormat->getArguments());
     $this->assertTrue($argsFormat->hasArgument('argument'));
     $this->assertTrue($argsFormat->hasArgument('global-argument'));
     $this->assertCount(2, $argsFormat->getOptions());
     $this->assertTrue($argsFormat->hasOption('option'));
     $this->assertTrue($argsFormat->hasOption('global-option'));
 }