public function testExceptionIsThrowWhenTryingToAddRequiredArgAfterOptionalArg()
 {
     $this->expectException(InvalidArgumentException::class);
     $this->expectExceptionMessage('A required argument cannot follow an optional argument');
     $definition = new CommandDefinition('animal', [], 'strlen');
     $definition->addArgument(CommandArgument::optional('optional-arg'))->addArgument(CommandArgument::required('required-arg'));
 }
Ejemplo n.º 2
0
 /**
  * Add any extra required arguments to the command.
  *
  * @param CommandDefinition $commandDefinition
  */
 public function configureInput(CommandDefinition $commandDefinition)
 {
     $commandDefinition->addArgument(CommandArgument::required('program'));
 }