+ public function testHasParameterOptionEdgeCasesAndLimitations()
+ {
+ $input = new ArgvInput(array('cli.php', '-fh'));
+ // hasParameterOption does not know if the previous short option, -f,
+ // takes a value or not. If -f takes a value, then -fh does NOT include
+ // -h; Otherwise it does. Since we do not know which short options take
+ // values, hasParameterOption does not support this use-case.
+ $this->assertFalse($input->hasParameterOption('-h'), '->hasParameterOption() returns true if the given short option is in the raw input');
+ // hasParameterOption does detect that `-fh` contains `-f`, since
+ // `-f` is the first short option in the set.
+ $this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input');
+ // The test below happens to pass, although it might make more sense
+ // to disallow it, and require the use of
+ // $input->hasParameterOption('-f') && $input->hasParameterOption('-h')
+ // instead.
+ $this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
+ // In theory, if -fh is supported, then -hf should also work.
+ // However, this is not supported.
+ $this->assertFalse($input->hasParameterOption('-hf'), '->hasParameterOption() returns true if the given short option is in the raw input');
+
+ $input = new ArgvInput(array('cli.php', '-f', '-h'));
+ // If hasParameterOption('-fh') is supported for 'cli.php -fh', then
+ // one might also expect that it should also be supported for
+ // 'cli.php -f -h'. However, this is not supported.
+ $this->assertFalse($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
+ }
+
+ public function testNoWarningOnInvalidParameterOption()
+ {
+ $input = new ArgvInput(array('cli.php', '-edev'));
+
+ $this->assertTrue($input->hasParameterOption(array('-e', '')));
+ // No warning thrown
+ $this->assertFalse($input->hasParameterOption(array('-m', '')));
+
+ $this->assertEquals('dev', $input->getParameterOption(array('-e', '')));
+ // No warning thrown
+ $this->assertFalse($input->getParameterOption(array('-m', '')));
+ }
+