You are here

public function ArgvInputTest::testParseNegativeNumberAfterDoubleDash in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Tests/Input/ArgvInputTest.php \Symfony\Component\Console\Tests\Input\ArgvInputTest::testParseNegativeNumberAfterDoubleDash()

File

vendor/symfony/console/Tests/Input/ArgvInputTest.php, line 237

Class

ArgvInputTest

Namespace

Symfony\Component\Console\Tests\Input

Code

public function testParseNegativeNumberAfterDoubleDash() {
  $input = new ArgvInput(array(
    'cli.php',
    '--',
    '-1',
  ));
  $input
    ->bind(new InputDefinition(array(
    new InputArgument('number'),
  )));
  $this
    ->assertEquals(array(
    'number' => '-1',
  ), $input
    ->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence');
  $input = new ArgvInput(array(
    'cli.php',
    '-f',
    'bar',
    '--',
    '-1',
  ));
  $input
    ->bind(new InputDefinition(array(
    new InputArgument('number'),
    new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL),
  )));
  $this
    ->assertEquals(array(
    'foo' => 'bar',
  ), $input
    ->getOptions(), '->parse() parses arguments with leading dashes as options before having encountered a double-dash sequence');
  $this
    ->assertEquals(array(
    'number' => '-1',
  ), $input
    ->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence');
}