$input->
bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL
),
new InputArgument('arg'
)]));
$this->
assertSame('bar',
$input->
getFirstArgument());
$input =
new ArgvInput(['cli.php', '-bf', 'fooval', 'argval'
]);
$input->
bind(new InputDefinition([new InputOption('bar', 'b', InputOption::VALUE_NONE
),
new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL
),
new InputArgument('arg'
)]));
$this->
assertSame('argval',
$input->
getFirstArgument());
} public function testHasParameterOption() { $input =
new ArgvInput(['cli.php', '-f', 'foo'
]);
$this->
assertTrue($input->
hasParameterOption('-f'
), '->hasParameterOption() returns true if the given short option is in the raw input'
);
$input =
new ArgvInput(['cli.php', '-etest'
]);
$this->
assertTrue($input->
hasParameterOption('-e'
), '->hasParameterOption() returns true if the given short option is in the raw input'
);
$this->
assertFalse($input->
hasParameterOption('-s'
), '->hasParameterOption() returns true if the given short option is in the raw input'
);
$input =
new ArgvInput(['cli.php', '--foo', 'foo'
]);
$this->
assertTrue($input->
hasParameterOption('--foo'
), '->hasParameterOption() returns true if the given short option is in the raw input'
);
$input =
new ArgvInput(['cli.php', 'foo'
]);
$this->
assertFalse($input->
hasParameterOption('--foo'
), '->hasParameterOption() returns false if the given short option is not in the raw input'
);