コード例 #1
0
 public function testBuildAnonymousArgsFormat()
 {
     $baseFormat = new ArgsFormat();
     $this->config->setName('command');
     $this->config->setAliases(array('alias1', 'alias2'));
     $this->config->addOption('option');
     $this->config->addArgument('argument');
     $this->config->markAnonymous();
     $expected = ArgsFormat::build($baseFormat)->addArgument(new Argument('argument'))->addOption(new Option('option'))->getFormat();
     $this->assertEquals($expected, $this->config->buildArgsFormat($baseFormat));
 }
コード例 #2
0
ファイル: CommandTest.php プロジェクト: webmozart/console
 /**
  * @expectedException \Webmozart\Console\Api\Command\CannotAddCommandException
  */
 public function testFailIfOptionCommandSameNameAsOptionShort()
 {
     $config = new CommandConfig('command');
     $config->addOption('option1', 'o');
     $config->addSubCommandConfig(new OptionCommandConfig('option2', 'o'));
     new Command($config);
 }