Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Symfony\Component\Console\Tests\Input; use PHPUnit\Framework\TestCase; us..

Decoded Output download

<?php
 namespace Symfony\Component\Console\Tests\Input; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; class ArgvInputTest extends TestCase { public function testConstructor() { $_SERVER["argv"] = array("cli.php", "foo"); $input = new ArgvInput(); $r = new \ReflectionObject($input); $p = $r->getProperty("tokens"); $this->assertEquals(array("foo"), $p->getValue($input), "__construct() automatically get its input from the argv server variable"); } public function testParseArguments() { $input = new ArgvInput(array("cli.php", "foo")); $input->bind(new InputDefinition(array(new InputArgument("name")))); $this->assertEquals(array("name" => "foo"), $input->getArguments(), "->parse() parses required arguments"); $input->bind(new InputDefinition(array(new InputArgument("name")))); $this->assertEquals(array("name" => "foo"), $input->getArguments(), "->parse() is stateless"); } public function testParseOptions($input, $options, $expectedOptions, $message) { $input = new ArgvInput($input); $input->bind(new InputDefinition($options)); $this->assertSame($expectedOptions, $input->getOptions(), $message); } public function testParseOptionsNegatable($input, $options, $expectedOptions, $message) { $input = new ArgvInput($input); $input->bind(new InputDefinition($options)); $this->assertEquals($expectedOptions, $input->getOptions(), $message); } public static function provideOptions() { return array(array(array("cli.php", "--foo"), array(new InputOption("foo")), array("foo" => true), "->parse() parses long options without a value"), array(array("cli.php", "--foo=bar"), array(new InputOption("foo", "f", InputOption::VALUE_REQUIRED)), array("foo" => "bar"), "->parse() parses long options with a required value (with a = separator)"), array(array("cli.php", "--foo", "bar"), array(new InputOption("foo", "f", InputOption::VALUE_REQUIRED)), array("foo" => "bar"), "->parse() parses long options with a required value (with a space separator)"), array(array("cli.php", "--foo="), array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL)), array("foo" => ''), "->parse() parses long options with optional value which is empty (with a = separator) as empty string"), array(array("cli.php", "--foo=", "bar"), array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL), new InputArgument("name", InputArgument::REQUIRED)), array("foo" => ''), "->parse() parses long options with optional value without value specified or an empty string (with a = separator) followed by an argument as empty string"), array(array("cli.php", "bar", "--foo"), array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL), new InputArgument("name", InputArgument::REQUIRED)), array("foo" => null), "->parse() parses long options with optional value which is empty (with a = separator) preceded by an argument"), array(array("cli.php", "--foo", '', "bar"), array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL), new InputArgument("name", InputArgument::REQUIRED)), array("foo" => ''), "->parse() parses long options with optional value which is empty as empty string even followed by an argument"), array(array("cli.php", "--foo"), array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL)), array("foo" => null), "->parse() parses long options with optional value specified with no separator and no value as null"), array(array("cli.php", "-f"), array(new InputOption("foo", "f")), array("foo" => true), "->parse() parses short options without a value"), array(array("cli.php", "-fbar"), array(new InputOption("foo", "f", InputOption::VALUE_REQUIRED)), array("foo" => "bar"), "->parse() parses short options with a required value (with no separator)"), array(array("cli.php", "-f", "bar"), array(new InputOption("foo", "f", InputOption::VALUE_REQUIRED)), array("foo" => "bar"), "->parse() parses short options with a required value (with a space separator)"), array(array("cli.php", "-f", ''), array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL)), array("foo" => ''), "->parse() parses short options with an optional empty value"), array(array("cli.php", "-f", '', "foo"), array(new InputArgument("name"), new InputOption("foo", "f", InputOption::VALUE_OPTIONAL)), array("foo" => ''), "->parse() parses short options with an optional empty value followed by an argument"), array(array("cli.php", "-f", '', "-b"), array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL), new InputOption("bar", "b")), array("foo" => '', "bar" => true), "->parse() parses short options with an optional empty value followed by an option"), array(array("cli.php", "-f", "-b", "foo"), array(new InputArgument("name"), new InputOption("foo", "f", InputOption::VALUE_OPTIONAL), new InputOption("bar", "b")), array("foo" => null, "bar" => true), "->parse() parses short options with an optional value which is not present"), array(array("cli.php", "-fb"), array(new InputOption("foo", "f"), new InputOption("bar", "b")), array("foo" => true, "bar" => true), "->parse() parses short options when they are aggregated as a single one"), array(array("cli.php", "-fb", "bar"), array(new InputOption("foo", "f"), new InputOption("bar", "b", InputOption::VALUE_REQUIRED)), array("foo" => true, "bar" => "bar"), "->parse() parses short options when they are aggregated as a single one and the last one has a required value"), array(array("cli.php", "-fb", "bar"), array(new InputOption("foo", "f"), new InputOption("bar", "b", InputOption::VALUE_OPTIONAL)), array("foo" => true, "bar" => "bar"), "->parse() parses short options when they are aggregated as a single one and the last one has an optional value"), array(array("cli.php", "-fbbar"), array(new InputOption("foo", "f"), new InputOption("bar", "b", InputOption::VALUE_OPTIONAL)), array("foo" => true, "bar" => "bar"), "->parse() parses short options when they are aggregated as a single one and the last one has an optional value with no separator"), array(array("cli.php", "-fbbar"), array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL), new InputOption("bar", "b", InputOption::VALUE_OPTIONAL)), array("foo" => "bbar", "bar" => null), "->parse() parses short options when they are aggregated as a single one and one of them takes a value")); } public static function provideNegatableOptions() { return array(array(array("cli.php", "--foo"), array(new InputOption("foo", null, InputOption::VALUE_NEGATABLE)), array("foo" => true), "->parse() parses long options without a value"), array(array("cli.php", "--foo"), array(new InputOption("foo", null, InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE)), array("foo" => true), "->parse() parses long options without a value"), array(array("cli.php", "--no-foo"), array(new InputOption("foo", null, InputOption::VALUE_NEGATABLE)), array("foo" => false), "->parse() parses long options without a value"), array(array("cli.php", "--no-foo"), array(new InputOption("foo", null, InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE)), array("foo" => false), "->parse() parses long options without a value"), array(array("cli.php"), array(new InputOption("foo", null, InputOption::VALUE_NEGATABLE)), array("foo" => null), "->parse() parses long options without a value"), array(array("cli.php"), array(new InputOption("foo", null, InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE)), array("foo" => null), "->parse() parses long options without a value"), array(array("cli.php"), array(new InputOption("foo", null, InputOption::VALUE_NEGATABLE, '', false)), array("foo" => false), "->parse() parses long options without a value")); } public function testInvalidInput($argv, $definition, $expectedExceptionMessage) { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage($expectedExceptionMessage); (new ArgvInput($argv))->bind($definition); } public function testInvalidInputNegatable($argv, $definition, $expectedExceptionMessage) { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage($expectedExceptionMessage); (new ArgvInput($argv))->bind($definition); } public static function provideInvalidInput() : array { return array(array(array("cli.php", "--foo"), new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_REQUIRED))), "The "--foo" option requires a value."), array(array("cli.php", "-f"), new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_REQUIRED))), "The "--foo" option requires a value."), array(array("cli.php", "-ffoo"), new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_NONE))), "The "-o" option does not exist."), array(array("cli.php", "--foo=bar"), new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_NONE))), "The "--foo" option does not accept a value."), array(array("cli.php", "foo", "bar"), new InputDefinition(), "No arguments expected, got "foo"."), array(array("cli.php", "foo", "bar"), new InputDefinition(array(new InputArgument("number"))), "Too many arguments, expected arguments "number"."), array(array("cli.php", "foo", "bar", "zzz"), new InputDefinition(array(new InputArgument("number"), new InputArgument("county"))), "Too many arguments, expected arguments "number" "county"."), array(array("cli.php", "--foo"), new InputDefinition(), "The "--foo" option does not exist."), array(array("cli.php", "-f"), new InputDefinition(), "The "-f" option does not exist."), array(array("cli.php", "-1"), new InputDefinition(array(new InputArgument("number"))), "The "-1" option does not exist."), array(array("cli.php", "-f"), new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_NONE))), "The "-" option does not exist."), array(array("cli.php", "acme:foo", "bar"), new InputDefinition(array(new InputArgument("command", InputArgument::REQUIRED))), "No arguments expected for "acme:foo" command, got "bar""), array(array("cli.php", "acme:foo", "bar"), new InputDefinition(array(new InputArgument("name", InputArgument::REQUIRED))), "Too many arguments, expected arguments "name".")); } public static function provideInvalidNegatableInput() : array { return array(array(array("cli.php", "--no-foo=bar"), new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_NEGATABLE))), "The "--no-foo" option does not accept a value."), array(array("cli.php", "--no-foo="), new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_NEGATABLE))), "The "--no-foo" option does not accept a value."), array(array("cli.php", "--no-foo=bar"), new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE))), "The "--no-foo" option does not accept a value."), array(array("cli.php", "--no-foo="), new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE))), "The "--no-foo" option does not accept a value.")); } public function testParseArrayArgument() { $input = new ArgvInput(array("cli.php", "foo", "bar", "baz", "bat")); $input->bind(new InputDefinition(array(new InputArgument("name", InputArgument::IS_ARRAY)))); $this->assertEquals(array("name" => array("foo", "bar", "baz", "bat")), $input->getArguments(), "->parse() parses array arguments"); } public function testParseArrayOption() { $input = new ArgvInput(array("cli.php", "--name=foo", "--name=bar", "--name=baz")); $input->bind(new InputDefinition(array(new InputOption("name", null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); $this->assertEquals(array("name" => array("foo", "bar", "baz")), $input->getOptions(), "->parse() parses array options ("--option=value" syntax)"); $input = new ArgvInput(array("cli.php", "--name", "foo", "--name", "bar", "--name", "baz")); $input->bind(new InputDefinition(array(new InputOption("name", null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); $this->assertEquals(array("name" => array("foo", "bar", "baz")), $input->getOptions(), "->parse() parses array options ("--option value" syntax)"); $input = new ArgvInput(array("cli.php", "--name=foo", "--name=bar", "--name=")); $input->bind(new InputDefinition(array(new InputOption("name", null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); $this->assertSame(array("name" => array("foo", "bar", '')), $input->getOptions(), "->parse() parses empty array options as null ("--option=value" syntax)"); $input = new ArgvInput(array("cli.php", "--name", "foo", "--name", "bar", "--name", "--anotherOption")); $input->bind(new InputDefinition(array(new InputOption("name", null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY), new InputOption("anotherOption", null, InputOption::VALUE_NONE)))); $this->assertSame(array("name" => array("foo", "bar", null), "anotherOption" => true), $input->getOptions(), "->parse() parses empty array options ("--option value" syntax)"); } 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"); } public function testParseEmptyStringArgument() { $input = new ArgvInput(array("cli.php", "-f", "bar", '')); $input->bind(new InputDefinition(array(new InputArgument("empty"), new InputOption("foo", "f", InputOption::VALUE_OPTIONAL)))); $this->assertEquals(array("empty" => ''), $input->getArguments(), "->parse() parses empty string arguments"); } public function testGetFirstArgument() { $input = new ArgvInput(array("cli.php", "-fbbar")); $this->assertNull($input->getFirstArgument(), "->getFirstArgument() returns null when there is no arguments"); $input = new ArgvInput(array("cli.php", "-fbbar", "foo")); $this->assertEquals("foo", $input->getFirstArgument(), "->getFirstArgument() returns the first argument from the raw input"); $input = new ArgvInput(array("cli.php", "--foo", "fooval", "bar")); $input->bind(new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL), new InputArgument("arg")))); $this->assertSame("bar", $input->getFirstArgument()); $input = new ArgvInput(array("cli.php", "-bf", "fooval", "argval")); $input->bind(new InputDefinition(array(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(array("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(array("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(array("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(array("cli.php", "foo")); $this->assertFalse($input->hasParameterOption("--foo"), "->hasParameterOption() returns false if the given short option is not in the raw input"); $input = new ArgvInput(array("cli.php", "--foo=bar")); $this->assertTrue($input->hasParameterOption("--foo"), "->hasParameterOption() returns true if the given option with provided value is in the raw input"); } public function testHasParameterOptionOnlyOptions() { $input = new ArgvInput(array("cli.php", "-f", "foo")); $this->assertTrue($input->hasParameterOption("-f", true), "->hasParameterOption() returns true if the given short option is in the raw input"); $input = new ArgvInput(array("cli.php", "--foo", "--", "foo")); $this->assertTrue($input->hasParameterOption("--foo", true), "->hasParameterOption() returns true if the given long option is in the raw input"); $input = new ArgvInput(array("cli.php", "--foo=bar", "foo")); $this->assertTrue($input->hasParameterOption("--foo", true), "->hasParameterOption() returns true if the given long option with provided value is in the raw input"); $input = new ArgvInput(array("cli.php", "--", "--foo")); $this->assertFalse($input->hasParameterOption("--foo", true), "->hasParameterOption() returns false if the given option is in the raw input but after an end of options signal"); } public function testHasParameterOptionEdgeCasesAndLimitations() { $input = new ArgvInput(array("cli.php", "-fh")); $this->assertFalse($input->hasParameterOption("-h"), "->hasParameterOption() returns true if the given short option is in the raw input"); $this->assertTrue($input->hasParameterOption("-f"), "->hasParameterOption() returns true if the given short option is in the raw input"); $this->assertTrue($input->hasParameterOption("-fh"), "->hasParameterOption() returns true if the given short option is in the raw input"); $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")); $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", ''))); $this->assertFalse($input->hasParameterOption(array("-m", ''))); $this->assertEquals("dev", $input->getParameterOption(array("-e", ''))); $this->assertFalse($input->getParameterOption(array("-m", ''))); } public function testToString() { $input = new ArgvInput(array("cli.php", "-f", "foo")); $this->assertEquals("-f foo", (string) $input); $input = new ArgvInput(array("cli.php", "-f", "--bar=foo", "a b c d", "A'C")); $this->assertEquals("-f --bar=foo " . escapeshellarg("a b c d") . " " . escapeshellarg("A'C"), (string) $input); } public function testGetParameterOptionEqualSign($argv, $key, $default, $onlyParams, $expected) { $input = new ArgvInput($argv); $this->assertEquals($expected, $input->getParameterOption($key, $default, $onlyParams), "->getParameterOption() returns the expected value"); } public static function provideGetParameterOptionValues() { return array(array(array("app/console", "foo:bar"), "-e", "default", false, "default"), array(array("app/console", "foo:bar", "-e", "dev"), "-e", "default", false, "dev"), array(array("app/console", "foo:bar", "--env=dev"), "--env", "default", false, "dev"), array(array("app/console", "foo:bar", "-e", "dev"), array("-e", "--env"), "default", false, "dev"), array(array("app/console", "foo:bar", "--env=dev"), array("-e", "--env"), "default", false, "dev"), array(array("app/console", "foo:bar", "--env=dev", "--en=1"), array("--en"), "default", false, "1"), array(array("app/console", "foo:bar", "--env=dev", '', "--en=1"), array("--en"), "default", false, "1"), array(array("app/console", "foo:bar", "--env", "val"), "--env", "default", false, "val"), array(array("app/console", "foo:bar", "--env", "val", "--dummy"), "--env", "default", false, "val"), array(array("app/console", "foo:bar", "--", "--env=dev"), "--env", "default", false, "dev"), array(array("app/console", "foo:bar", "--", "--env=dev"), "--env", "default", true, "default")); } public function testParseSingleDashAsArgument() { $input = new ArgvInput(array("cli.php", "-")); $input->bind(new InputDefinition(array(new InputArgument("file")))); $this->assertEquals(array("file" => "-"), $input->getArguments(), "->parse() parses single dash as an argument"); } public function testParseOptionWithValueOptionalGivenEmptyAndRequiredArgument() { $input = new ArgvInput(array("cli.php", "--foo=", "bar")); $input->bind(new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL), new InputArgument("name", InputArgument::REQUIRED)))); $this->assertEquals(array("foo" => null), $input->getOptions(), "->parse() parses optional options with empty value as null"); $this->assertEquals(array("name" => "bar"), $input->getArguments(), "->parse() parses required arguments"); $input = new ArgvInput(array("cli.php", "--foo=0", "bar")); $input->bind(new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL), new InputArgument("name", InputArgument::REQUIRED)))); $this->assertEquals(array("foo" => "0"), $input->getOptions(), "->parse() parses optional options with empty value as null"); $this->assertEquals(array("name" => "bar"), $input->getArguments(), "->parse() parses required arguments"); } public function testParseOptionWithValueOptionalGivenEmptyAndOptionalArgument() { $input = new ArgvInput(array("cli.php", "--foo=", "bar")); $input->bind(new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL), new InputArgument("name", InputArgument::OPTIONAL)))); $this->assertEquals(array("foo" => null), $input->getOptions(), "->parse() parses optional options with empty value as null"); $this->assertEquals(array("name" => "bar"), $input->getArguments(), "->parse() parses optional arguments"); $input = new ArgvInput(array("cli.php", "--foo=0", "bar")); $input->bind(new InputDefinition(array(new InputOption("foo", "f", InputOption::VALUE_OPTIONAL), new InputArgument("name", InputArgument::OPTIONAL)))); $this->assertEquals(array("foo" => "0"), $input->getOptions(), "->parse() parses optional options with empty value as null"); $this->assertEquals(array("name" => "bar"), $input->getArguments(), "->parse() parses optional arguments"); } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace Symfony\Component\Console\Tests\Input; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; class ArgvInputTest extends TestCase { public function testConstructor() { $_SERVER["\x61\162\147\x76"] = array("\143\154\x69\x2e\160\150\x70", "\146\x6f\157"); $input = new ArgvInput(); $r = new \ReflectionObject($input); $p = $r->getProperty("\164\x6f\153\x65\x6e\x73"); $this->assertEquals(array("\146\x6f\x6f"), $p->getValue($input), "\x5f\137\143\x6f\156\x73\x74\x72\x75\x63\x74\50\51\x20\141\165\x74\x6f\155\x61\x74\151\x63\141\x6c\x6c\171\40\x67\x65\164\x20\151\x74\163\40\151\x6e\160\165\164\x20\x66\162\157\x6d\40\x74\150\x65\x20\x61\162\147\x76\40\163\x65\162\x76\x65\162\40\x76\141\162\x69\x61\142\x6c\x65"); } public function testParseArguments() { $input = new ArgvInput(array("\143\x6c\151\56\160\x68\x70", "\146\157\x6f")); $input->bind(new InputDefinition(array(new InputArgument("\x6e\141\155\x65")))); $this->assertEquals(array("\156\x61\155\x65" => "\146\157\157"), $input->getArguments(), "\x2d\76\x70\x61\x72\163\x65\x28\x29\x20\160\141\162\x73\x65\x73\40\162\145\x71\x75\x69\162\145\144\40\141\162\147\165\155\x65\156\x74\x73"); $input->bind(new InputDefinition(array(new InputArgument("\x6e\x61\155\x65")))); $this->assertEquals(array("\x6e\x61\x6d\x65" => "\x66\x6f\157"), $input->getArguments(), "\x2d\x3e\x70\141\x72\x73\145\50\51\x20\x69\163\x20\163\164\x61\x74\145\154\x65\x73\x73"); } public function testParseOptions($input, $options, $expectedOptions, $message) { $input = new ArgvInput($input); $input->bind(new InputDefinition($options)); $this->assertSame($expectedOptions, $input->getOptions(), $message); } public function testParseOptionsNegatable($input, $options, $expectedOptions, $message) { $input = new ArgvInput($input); $input->bind(new InputDefinition($options)); $this->assertEquals($expectedOptions, $input->getOptions(), $message); } public static function provideOptions() { return array(array(array("\x63\x6c\151\56\x70\150\160", "\55\x2d\146\x6f\x6f"), array(new InputOption("\146\157\x6f")), array("\x66\157\157" => true), "\x2d\x3e\160\141\162\163\x65\50\x29\40\160\141\162\163\x65\163\40\154\x6f\x6e\x67\x20\x6f\160\x74\151\x6f\x6e\163\x20\167\x69\x74\x68\157\165\x74\40\x61\x20\x76\141\154\165\145"), array(array("\x63\x6c\151\x2e\160\x68\160", "\x2d\x2d\x66\x6f\x6f\75\142\x61\x72"), array(new InputOption("\x66\157\157", "\146", InputOption::VALUE_REQUIRED)), array("\146\x6f\x6f" => "\x62\141\x72"), "\55\76\x70\141\162\163\145\x28\x29\40\x70\x61\162\x73\145\163\40\x6c\x6f\156\147\x20\157\x70\x74\151\157\x6e\x73\40\167\151\x74\x68\40\141\40\x72\145\161\x75\151\162\x65\x64\40\x76\x61\154\x75\145\40\x28\x77\151\x74\150\40\x61\40\x3d\40\x73\145\x70\141\x72\141\164\x6f\162\51"), array(array("\x63\154\151\x2e\x70\x68\160", "\x2d\55\146\157\x6f", "\x62\x61\162"), array(new InputOption("\x66\157\157", "\146", InputOption::VALUE_REQUIRED)), array("\x66\x6f\x6f" => "\x62\141\x72"), "\x2d\76\160\141\162\x73\x65\x28\51\40\160\141\x72\x73\145\x73\40\x6c\157\x6e\147\40\157\160\164\151\157\156\163\40\167\151\164\150\40\x61\x20\162\145\x71\x75\151\x72\x65\x64\40\x76\141\x6c\x75\145\x20\50\167\151\x74\150\40\141\40\163\x70\141\x63\145\40\163\145\x70\141\162\x61\x74\157\x72\51"), array(array("\143\x6c\x69\56\x70\x68\160", "\x2d\x2d\146\x6f\157\x3d"), array(new InputOption("\146\x6f\157", "\x66", InputOption::VALUE_OPTIONAL)), array("\146\157\157" => ''), "\55\76\x70\141\162\163\145\x28\51\40\x70\141\x72\x73\145\x73\40\154\157\156\x67\x20\157\160\164\x69\157\x6e\163\x20\x77\x69\164\x68\x20\x6f\160\x74\151\x6f\156\x61\154\40\x76\x61\x6c\165\x65\x20\x77\x68\151\x63\150\40\x69\x73\40\x65\155\x70\x74\171\x20\x28\x77\151\x74\x68\x20\x61\40\75\x20\163\145\x70\141\162\141\164\157\x72\51\40\x61\x73\40\x65\155\x70\164\x79\40\x73\164\x72\x69\156\147"), array(array("\x63\x6c\x69\56\160\150\x70", "\55\55\146\x6f\157\75", "\142\x61\162"), array(new InputOption("\x66\x6f\157", "\x66", InputOption::VALUE_OPTIONAL), new InputArgument("\156\x61\155\145", InputArgument::REQUIRED)), array("\146\157\x6f" => ''), "\x2d\76\x70\141\x72\x73\145\50\x29\x20\x70\141\x72\x73\145\x73\x20\154\157\x6e\147\40\x6f\x70\164\x69\157\156\x73\x20\x77\x69\164\x68\x20\x6f\x70\x74\151\x6f\x6e\141\x6c\40\166\141\x6c\x75\145\40\167\x69\x74\150\157\x75\164\x20\166\x61\x6c\165\x65\40\163\x70\145\143\151\146\151\x65\144\40\157\x72\40\141\156\x20\x65\155\160\x74\171\40\163\x74\x72\151\156\147\x20\x28\x77\151\x74\150\40\x61\40\x3d\40\163\x65\160\141\162\141\164\x6f\x72\x29\x20\x66\157\154\x6c\x6f\x77\x65\144\x20\142\171\x20\x61\156\x20\x61\162\147\165\155\145\156\x74\x20\x61\x73\40\145\x6d\160\164\x79\x20\x73\164\x72\151\x6e\x67"), array(array("\x63\154\x69\56\x70\150\x70", "\x62\141\162", "\x2d\x2d\x66\x6f\x6f"), array(new InputOption("\x66\x6f\157", "\x66", InputOption::VALUE_OPTIONAL), new InputArgument("\156\141\155\x65", InputArgument::REQUIRED)), array("\146\x6f\x6f" => null), "\55\x3e\x70\x61\162\x73\x65\x28\51\40\160\141\162\163\145\x73\x20\x6c\157\x6e\147\x20\157\160\164\151\x6f\156\163\x20\x77\151\164\150\40\x6f\x70\164\x69\x6f\x6e\x61\154\40\x76\x61\x6c\165\x65\40\167\x68\x69\x63\150\40\x69\163\40\x65\x6d\160\164\x79\40\x28\x77\x69\164\150\40\141\40\x3d\40\163\145\160\141\162\x61\x74\157\x72\x29\x20\x70\162\x65\143\x65\144\x65\x64\40\142\x79\40\141\x6e\x20\x61\x72\x67\x75\155\145\x6e\x74"), array(array("\x63\154\151\56\x70\150\160", "\x2d\55\x66\x6f\x6f", '', "\142\141\162"), array(new InputOption("\x66\x6f\157", "\146", InputOption::VALUE_OPTIONAL), new InputArgument("\156\141\155\145", InputArgument::REQUIRED)), array("\146\x6f\157" => ''), "\55\76\x70\141\x72\163\145\x28\51\x20\160\141\162\163\145\163\x20\154\x6f\x6e\x67\40\157\160\164\151\157\x6e\x73\x20\167\x69\x74\150\40\x6f\160\164\151\x6f\x6e\141\x6c\x20\166\141\x6c\x75\145\x20\167\150\x69\x63\150\x20\151\163\40\145\155\160\164\x79\x20\141\163\x20\145\155\x70\164\x79\40\163\x74\x72\x69\x6e\x67\x20\145\166\145\156\40\146\157\x6c\x6c\157\167\x65\x64\x20\x62\171\x20\141\x6e\x20\141\162\147\165\155\145\156\164"), array(array("\143\x6c\151\x2e\x70\150\x70", "\x2d\x2d\146\x6f\157"), array(new InputOption("\146\157\157", "\146", InputOption::VALUE_OPTIONAL)), array("\x66\157\x6f" => null), "\x2d\76\160\141\162\163\145\x28\x29\40\160\x61\x72\x73\145\163\40\154\157\x6e\x67\40\x6f\x70\164\151\157\156\x73\40\167\151\x74\x68\x20\157\160\x74\x69\157\x6e\141\154\x20\x76\141\x6c\x75\x65\x20\x73\160\145\x63\151\x66\151\x65\x64\x20\167\151\164\x68\40\156\157\40\x73\145\x70\x61\162\141\x74\x6f\x72\40\x61\x6e\144\40\156\157\x20\166\141\154\165\x65\40\x61\163\40\x6e\165\154\x6c"), array(array("\x63\x6c\151\x2e\160\150\x70", "\55\x66"), array(new InputOption("\x66\157\x6f", "\146")), array("\146\157\x6f" => true), "\55\x3e\160\x61\x72\x73\145\x28\x29\40\160\141\162\x73\x65\163\40\163\x68\x6f\162\x74\40\x6f\160\164\x69\x6f\x6e\163\x20\x77\x69\164\x68\x6f\165\164\x20\141\40\x76\141\x6c\x75\x65"), array(array("\x63\x6c\151\x2e\x70\150\160", "\x2d\x66\142\x61\x72"), array(new InputOption("\146\x6f\x6f", "\146", InputOption::VALUE_REQUIRED)), array("\146\x6f\157" => "\x62\141\162"), "\55\x3e\160\x61\162\x73\x65\50\x29\40\160\141\x72\x73\x65\163\x20\x73\150\x6f\x72\x74\x20\x6f\x70\x74\151\157\156\x73\x20\167\x69\x74\x68\x20\x61\x20\162\x65\x71\x75\151\x72\145\144\x20\166\141\154\x75\x65\x20\50\167\x69\164\150\x20\156\x6f\x20\163\145\160\x61\x72\141\x74\x6f\x72\x29"), array(array("\143\x6c\151\56\160\150\160", "\55\x66", "\x62\x61\x72"), array(new InputOption("\146\157\x6f", "\x66", InputOption::VALUE_REQUIRED)), array("\x66\x6f\x6f" => "\x62\x61\162"), "\55\x3e\x70\x61\x72\163\x65\x28\x29\40\x70\141\x72\163\145\x73\x20\x73\x68\157\162\x74\40\x6f\160\164\x69\157\x6e\x73\40\x77\x69\x74\x68\x20\141\40\162\x65\x71\165\151\162\x65\144\40\x76\x61\x6c\165\x65\x20\50\167\151\164\150\40\x61\40\163\x70\x61\x63\145\x20\163\145\x70\x61\x72\141\164\x6f\x72\x29"), array(array("\x63\x6c\x69\x2e\160\x68\160", "\x2d\x66", ''), array(new InputOption("\146\x6f\157", "\146", InputOption::VALUE_OPTIONAL)), array("\x66\x6f\157" => ''), "\55\76\160\x61\x72\163\145\50\x29\40\x70\x61\162\x73\x65\x73\40\163\x68\157\162\164\x20\157\x70\164\x69\x6f\156\x73\40\167\151\164\x68\x20\141\156\x20\157\x70\164\x69\157\156\141\154\x20\x65\155\160\164\x79\40\x76\x61\154\165\145"), array(array("\x63\x6c\151\x2e\x70\150\160", "\x2d\x66", '', "\146\157\157"), array(new InputArgument("\156\x61\x6d\x65"), new InputOption("\146\x6f\x6f", "\146", InputOption::VALUE_OPTIONAL)), array("\x66\x6f\157" => ''), "\55\x3e\160\141\x72\x73\145\x28\x29\40\x70\141\162\x73\145\163\40\163\150\x6f\x72\164\40\x6f\160\x74\x69\x6f\156\163\x20\x77\151\x74\x68\x20\141\156\40\x6f\x70\x74\151\157\x6e\x61\154\x20\145\x6d\160\x74\171\x20\x76\141\x6c\165\145\40\x66\157\x6c\x6c\x6f\x77\x65\144\x20\142\171\40\x61\156\40\x61\x72\147\x75\155\x65\x6e\164"), array(array("\143\x6c\151\x2e\160\x68\x70", "\55\146", '', "\55\x62"), array(new InputOption("\x66\x6f\157", "\146", InputOption::VALUE_OPTIONAL), new InputOption("\142\x61\162", "\x62")), array("\x66\157\x6f" => '', "\x62\x61\x72" => true), "\55\x3e\x70\141\x72\x73\x65\50\51\40\x70\x61\x72\x73\x65\x73\40\163\x68\x6f\162\164\x20\x6f\x70\x74\151\x6f\156\163\x20\x77\151\x74\150\x20\x61\156\x20\x6f\x70\164\151\x6f\156\x61\x6c\40\x65\x6d\160\164\x79\x20\x76\141\x6c\x75\145\40\146\x6f\x6c\x6c\x6f\x77\145\144\x20\142\x79\x20\x61\156\x20\x6f\160\164\151\x6f\x6e"), array(array("\143\x6c\x69\x2e\160\x68\x70", "\x2d\x66", "\55\142", "\x66\x6f\x6f"), array(new InputArgument("\x6e\141\x6d\145"), new InputOption("\x66\x6f\x6f", "\146", InputOption::VALUE_OPTIONAL), new InputOption("\142\141\162", "\142")), array("\x66\157\157" => null, "\x62\141\x72" => true), "\x2d\x3e\x70\141\162\163\145\x28\x29\40\160\141\x72\163\145\163\x20\x73\150\157\x72\164\40\157\x70\x74\151\157\x6e\x73\x20\x77\x69\x74\x68\40\141\x6e\x20\x6f\x70\x74\151\x6f\x6e\x61\x6c\40\166\141\154\x75\145\40\167\x68\x69\x63\x68\x20\151\163\x20\156\157\x74\40\160\x72\145\x73\x65\156\164"), array(array("\143\x6c\x69\56\160\x68\x70", "\x2d\x66\142"), array(new InputOption("\146\157\x6f", "\146"), new InputOption("\142\141\162", "\x62")), array("\x66\x6f\157" => true, "\x62\x61\162" => true), "\55\76\x70\141\162\163\145\50\51\40\x70\x61\x72\x73\145\x73\40\x73\150\x6f\x72\164\x20\x6f\160\x74\151\157\156\x73\x20\167\150\145\156\x20\164\150\x65\x79\40\x61\x72\145\40\x61\147\147\162\145\147\141\x74\x65\x64\40\141\163\x20\141\40\x73\x69\x6e\147\154\145\40\157\156\x65"), array(array("\x63\x6c\151\56\160\150\160", "\x2d\146\x62", "\142\x61\x72"), array(new InputOption("\146\157\x6f", "\146"), new InputOption("\x62\x61\x72", "\x62", InputOption::VALUE_REQUIRED)), array("\146\157\157" => true, "\142\x61\x72" => "\x62\141\x72"), "\55\x3e\160\141\162\163\145\50\x29\40\x70\141\162\x73\145\163\40\x73\x68\157\x72\x74\x20\x6f\x70\x74\151\157\x6e\x73\x20\x77\150\145\x6e\40\x74\x68\x65\171\40\x61\162\145\40\x61\x67\147\162\145\x67\141\164\145\144\40\x61\163\40\141\x20\163\151\x6e\147\154\145\x20\x6f\x6e\x65\40\141\x6e\x64\x20\x74\150\145\x20\x6c\141\163\x74\x20\157\156\x65\40\x68\x61\x73\40\141\40\162\x65\161\x75\x69\x72\145\144\x20\166\x61\154\165\145"), array(array("\143\x6c\151\56\x70\150\x70", "\x2d\x66\x62", "\x62\x61\162"), array(new InputOption("\x66\x6f\x6f", "\x66"), new InputOption("\142\x61\x72", "\142", InputOption::VALUE_OPTIONAL)), array("\x66\157\157" => true, "\x62\x61\162" => "\x62\141\x72"), "\55\76\x70\141\x72\163\x65\x28\51\40\160\x61\x72\163\x65\163\x20\163\150\157\x72\164\40\157\160\164\151\x6f\156\163\40\167\150\x65\156\x20\164\x68\145\171\40\141\x72\145\40\x61\x67\147\162\x65\x67\x61\x74\145\144\x20\x61\x73\x20\141\x20\163\x69\x6e\x67\x6c\145\x20\157\x6e\145\x20\x61\x6e\x64\40\x74\150\x65\x20\x6c\x61\x73\x74\40\157\x6e\x65\x20\150\141\163\40\x61\156\x20\x6f\x70\x74\x69\157\156\141\x6c\x20\166\x61\154\x75\x65"), array(array("\143\154\151\56\160\x68\x70", "\55\146\142\x62\141\162"), array(new InputOption("\x66\x6f\157", "\x66"), new InputOption("\142\141\162", "\142", InputOption::VALUE_OPTIONAL)), array("\x66\157\157" => true, "\x62\x61\162" => "\x62\141\162"), "\55\x3e\x70\141\x72\x73\x65\50\51\40\160\141\162\x73\145\163\x20\163\150\x6f\162\x74\40\x6f\x70\164\151\157\x6e\x73\x20\x77\150\145\156\x20\164\x68\145\171\x20\141\x72\145\x20\141\x67\x67\x72\145\x67\141\x74\x65\144\x20\x61\x73\40\141\40\163\x69\x6e\147\154\x65\40\157\156\x65\x20\x61\x6e\144\40\x74\150\145\x20\x6c\141\x73\164\x20\157\x6e\x65\40\150\x61\163\40\141\x6e\40\157\x70\x74\x69\x6f\x6e\x61\x6c\40\166\x61\x6c\165\x65\x20\167\151\x74\x68\x20\x6e\157\x20\x73\145\160\141\x72\141\x74\x6f\x72"), array(array("\x63\154\151\56\x70\x68\160", "\x2d\146\142\x62\x61\162"), array(new InputOption("\146\x6f\157", "\146", InputOption::VALUE_OPTIONAL), new InputOption("\x62\x61\162", "\142", InputOption::VALUE_OPTIONAL)), array("\146\157\x6f" => "\142\x62\141\162", "\142\x61\x72" => null), "\55\76\160\141\x72\x73\x65\x28\51\40\160\x61\162\x73\145\x73\x20\x73\x68\157\x72\x74\x20\x6f\x70\164\151\157\156\x73\x20\167\150\x65\x6e\x20\164\x68\x65\171\40\x61\x72\x65\x20\x61\x67\x67\162\145\x67\141\x74\x65\144\x20\x61\x73\40\141\x20\163\151\x6e\x67\154\145\x20\157\156\145\x20\x61\x6e\144\40\x6f\x6e\145\x20\157\x66\40\x74\150\145\x6d\x20\x74\x61\x6b\145\163\40\x61\40\x76\141\x6c\x75\145")); } public static function provideNegatableOptions() { return array(array(array("\x63\x6c\x69\56\160\150\x70", "\55\x2d\146\157\x6f"), array(new InputOption("\x66\157\x6f", null, InputOption::VALUE_NEGATABLE)), array("\x66\x6f\x6f" => true), "\55\x3e\x70\x61\162\163\x65\50\51\x20\160\141\162\x73\x65\x73\40\154\x6f\x6e\x67\40\157\x70\164\151\157\156\x73\x20\x77\151\x74\150\157\x75\x74\40\x61\40\166\x61\154\x75\145"), array(array("\x63\154\151\56\x70\x68\x70", "\x2d\55\x66\x6f\157"), array(new InputOption("\x66\157\x6f", null, InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE)), array("\146\157\x6f" => true), "\x2d\76\x70\x61\x72\163\x65\50\x29\x20\x70\141\x72\163\x65\x73\x20\x6c\x6f\x6e\x67\40\157\x70\x74\x69\157\156\x73\40\167\151\x74\150\x6f\165\164\x20\141\40\166\x61\154\165\x65"), array(array("\143\154\151\56\x70\150\x70", "\55\55\156\x6f\x2d\146\x6f\157"), array(new InputOption("\146\x6f\157", null, InputOption::VALUE_NEGATABLE)), array("\146\x6f\157" => false), "\x2d\76\160\141\162\x73\x65\50\51\x20\x70\x61\x72\x73\x65\x73\x20\154\157\x6e\x67\x20\157\x70\164\x69\x6f\156\x73\x20\167\151\164\x68\x6f\165\x74\40\x61\x20\x76\141\x6c\165\x65"), array(array("\x63\154\151\x2e\160\150\160", "\x2d\55\156\157\55\x66\x6f\x6f"), array(new InputOption("\146\x6f\157", null, InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE)), array("\x66\x6f\x6f" => false), "\x2d\x3e\x70\x61\162\x73\x65\50\51\40\160\x61\x72\163\x65\163\40\154\x6f\x6e\x67\x20\x6f\x70\x74\x69\x6f\x6e\163\x20\x77\151\x74\150\157\x75\x74\40\x61\x20\166\141\x6c\x75\x65"), array(array("\x63\154\151\x2e\160\x68\160"), array(new InputOption("\146\157\x6f", null, InputOption::VALUE_NEGATABLE)), array("\146\157\157" => null), "\55\76\160\x61\162\x73\x65\50\51\x20\x70\x61\162\163\145\x73\x20\x6c\x6f\x6e\147\40\157\x70\164\151\x6f\x6e\163\40\167\x69\x74\x68\x6f\165\x74\40\141\x20\x76\x61\154\165\145"), array(array("\x63\x6c\x69\x2e\160\150\160"), array(new InputOption("\x66\157\157", null, InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE)), array("\x66\157\x6f" => null), "\55\76\160\x61\x72\x73\x65\x28\x29\x20\160\141\x72\x73\x65\163\x20\x6c\157\x6e\x67\40\x6f\160\x74\151\x6f\x6e\163\x20\x77\151\164\x68\x6f\165\164\40\x61\40\166\x61\x6c\165\145"), array(array("\143\x6c\x69\56\x70\x68\x70"), array(new InputOption("\x66\x6f\x6f", null, InputOption::VALUE_NEGATABLE, '', false)), array("\x66\x6f\x6f" => false), "\x2d\76\160\x61\x72\x73\x65\x28\x29\40\x70\141\162\x73\x65\163\x20\x6c\x6f\156\x67\x20\157\160\164\x69\x6f\156\163\40\167\151\164\150\x6f\x75\164\x20\141\x20\166\141\x6c\165\145")); } public function testInvalidInput($argv, $definition, $expectedExceptionMessage) { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage($expectedExceptionMessage); (new ArgvInput($argv))->bind($definition); } public function testInvalidInputNegatable($argv, $definition, $expectedExceptionMessage) { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage($expectedExceptionMessage); (new ArgvInput($argv))->bind($definition); } public static function provideInvalidInput() : array { return array(array(array("\143\154\x69\x2e\160\150\160", "\x2d\x2d\x66\x6f\x6f"), new InputDefinition(array(new InputOption("\146\x6f\x6f", "\x66", InputOption::VALUE_REQUIRED))), "\124\150\145\40\x22\55\x2d\x66\x6f\x6f\42\40\157\x70\164\x69\x6f\x6e\x20\162\x65\161\x75\151\x72\145\x73\40\x61\x20\166\141\x6c\x75\x65\56"), array(array("\x63\154\x69\x2e\x70\150\x70", "\x2d\x66"), new InputDefinition(array(new InputOption("\x66\x6f\x6f", "\x66", InputOption::VALUE_REQUIRED))), "\124\150\145\40\x22\x2d\x2d\146\157\157\42\x20\157\160\164\x69\157\x6e\40\162\145\x71\165\151\162\145\x73\40\141\x20\166\141\154\x75\145\56"), array(array("\143\154\x69\x2e\x70\150\x70", "\x2d\x66\146\157\157"), new InputDefinition(array(new InputOption("\146\157\x6f", "\146", InputOption::VALUE_NONE))), "\124\150\x65\40\x22\x2d\x6f\42\40\157\160\x74\x69\x6f\x6e\x20\144\157\x65\163\x20\x6e\157\x74\40\145\170\x69\x73\x74\x2e"), array(array("\143\154\151\56\x70\x68\x70", "\55\55\x66\x6f\157\x3d\142\x61\x72"), new InputDefinition(array(new InputOption("\146\x6f\x6f", "\146", InputOption::VALUE_NONE))), "\x54\150\x65\x20\x22\x2d\x2d\146\x6f\x6f\42\40\x6f\x70\164\x69\157\156\40\x64\157\x65\163\x20\x6e\157\x74\40\141\143\x63\145\x70\164\x20\141\40\x76\x61\154\x75\145\56"), array(array("\x63\154\x69\x2e\160\150\160", "\x66\157\x6f", "\x62\141\x72"), new InputDefinition(), "\x4e\157\x20\141\x72\147\165\155\145\x6e\x74\163\x20\x65\170\160\145\x63\x74\145\x64\x2c\x20\x67\157\x74\40\x22\146\157\157\42\56"), array(array("\x63\x6c\x69\56\160\150\160", "\146\x6f\157", "\x62\x61\162"), new InputDefinition(array(new InputArgument("\x6e\165\155\142\145\162"))), "\x54\x6f\157\x20\x6d\x61\156\171\x20\x61\x72\147\165\x6d\x65\156\164\163\x2c\x20\145\x78\160\x65\143\164\145\x64\40\141\x72\x67\165\x6d\x65\156\x74\x73\x20\42\x6e\x75\155\x62\x65\162\42\x2e"), array(array("\x63\x6c\x69\x2e\160\150\x70", "\x66\157\157", "\x62\141\x72", "\172\172\172"), new InputDefinition(array(new InputArgument("\x6e\165\155\x62\145\162"), new InputArgument("\x63\x6f\x75\x6e\x74\171"))), "\x54\157\157\x20\x6d\x61\x6e\171\40\x61\162\x67\165\155\145\156\x74\163\x2c\x20\x65\170\x70\x65\x63\x74\x65\x64\x20\x61\162\x67\x75\x6d\145\x6e\x74\x73\x20\42\156\165\x6d\142\145\x72\x22\40\x22\143\157\x75\156\164\x79\42\x2e"), array(array("\143\x6c\151\56\160\x68\160", "\55\55\x66\157\x6f"), new InputDefinition(), "\x54\150\145\40\42\x2d\x2d\146\x6f\157\42\x20\157\160\164\x69\x6f\x6e\40\x64\x6f\x65\163\x20\x6e\157\x74\40\145\x78\x69\x73\x74\56"), array(array("\143\x6c\151\x2e\x70\x68\160", "\55\x66"), new InputDefinition(), "\124\150\x65\40\x22\x2d\x66\42\40\x6f\x70\x74\x69\x6f\156\x20\x64\157\x65\x73\x20\156\x6f\164\40\145\170\x69\x73\164\x2e"), array(array("\x63\x6c\x69\x2e\x70\x68\x70", "\55\61"), new InputDefinition(array(new InputArgument("\x6e\165\155\x62\145\162"))), "\x54\x68\x65\x20\x22\x2d\x31\x22\x20\x6f\160\164\x69\x6f\x6e\40\144\157\145\163\x20\x6e\157\164\x20\x65\170\x69\163\x74\56"), array(array("\x63\x6c\151\56\x70\x68\x70", "\x2d\x66\320\xa9"), new InputDefinition(array(new InputOption("\146\157\157", "\146", InputOption::VALUE_NONE))), "\x54\150\145\40\x22\x2d\xd0\251\42\40\x6f\x70\x74\x69\157\x6e\x20\x64\157\x65\163\40\x6e\x6f\x74\40\145\x78\x69\x73\164\56"), array(array("\x63\x6c\151\x2e\x70\150\x70", "\141\x63\x6d\145\72\x66\157\157", "\142\x61\x72"), new InputDefinition(array(new InputArgument("\x63\x6f\155\155\141\156\144", InputArgument::REQUIRED))), "\x4e\157\40\x61\x72\x67\x75\x6d\x65\156\x74\163\x20\145\170\160\x65\143\164\145\x64\x20\146\x6f\162\40\42\141\143\155\x65\72\146\157\x6f\x22\x20\x63\157\155\155\141\x6e\x64\x2c\x20\x67\x6f\x74\40\x22\x62\141\x72\x22"), array(array("\x63\x6c\x69\56\x70\x68\x70", "\141\143\x6d\145\72\x66\157\157", "\x62\x61\162"), new InputDefinition(array(new InputArgument("\x6e\141\x6d\x65", InputArgument::REQUIRED))), "\124\157\157\x20\x6d\141\156\171\40\x61\162\147\x75\x6d\145\x6e\164\163\x2c\x20\x65\x78\160\x65\x63\x74\145\x64\x20\x61\162\147\x75\155\x65\156\164\163\40\x22\156\141\155\x65\42\x2e")); } public static function provideInvalidNegatableInput() : array { return array(array(array("\x63\x6c\151\x2e\160\x68\x70", "\55\x2d\x6e\x6f\55\x66\x6f\x6f\75\142\141\162"), new InputDefinition(array(new InputOption("\146\x6f\x6f", "\x66", InputOption::VALUE_NEGATABLE))), "\124\x68\145\x20\42\x2d\55\x6e\x6f\55\146\x6f\157\x22\x20\x6f\x70\x74\x69\157\156\x20\144\157\145\163\40\156\157\164\40\141\x63\143\x65\x70\x74\x20\x61\x20\x76\x61\x6c\x75\145\56"), array(array("\143\154\x69\x2e\x70\x68\x70", "\x2d\55\156\x6f\x2d\146\x6f\157\x3d"), new InputDefinition(array(new InputOption("\x66\157\157", "\x66", InputOption::VALUE_NEGATABLE))), "\x54\150\x65\x20\42\x2d\x2d\x6e\157\x2d\x66\x6f\x6f\42\x20\157\160\164\151\157\x6e\x20\x64\x6f\145\x73\40\x6e\157\164\40\x61\143\143\145\160\164\40\x61\x20\166\141\154\x75\x65\x2e"), array(array("\x63\x6c\151\x2e\160\150\x70", "\x2d\55\156\157\55\x66\x6f\157\75\142\x61\x72"), new InputDefinition(array(new InputOption("\x66\157\157", "\x66", InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE))), "\124\x68\x65\40\x22\x2d\55\156\157\x2d\x66\157\x6f\x22\40\157\160\x74\x69\157\156\40\144\157\x65\x73\x20\x6e\157\164\40\x61\143\143\x65\160\164\40\x61\40\166\141\x6c\165\145\56"), array(array("\143\154\x69\56\x70\x68\x70", "\x2d\x2d\x6e\x6f\55\146\157\x6f\75"), new InputDefinition(array(new InputOption("\146\157\157", "\146", InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE))), "\124\x68\145\40\42\x2d\55\x6e\157\55\146\x6f\157\x22\x20\x6f\160\x74\151\x6f\156\40\144\x6f\x65\163\40\x6e\157\164\40\x61\143\x63\x65\160\164\x20\141\40\166\141\154\x75\x65\x2e")); } public function testParseArrayArgument() { $input = new ArgvInput(array("\x63\x6c\151\x2e\160\150\160", "\x66\157\x6f", "\x62\x61\162", "\142\x61\172", "\142\x61\x74")); $input->bind(new InputDefinition(array(new InputArgument("\x6e\141\155\145", InputArgument::IS_ARRAY)))); $this->assertEquals(array("\x6e\141\x6d\x65" => array("\146\157\157", "\x62\141\x72", "\142\x61\x7a", "\142\x61\x74")), $input->getArguments(), "\x2d\76\160\141\162\163\145\x28\x29\40\160\141\162\x73\145\x73\x20\141\x72\162\141\171\x20\x61\162\147\165\155\x65\156\x74\163"); } public function testParseArrayOption() { $input = new ArgvInput(array("\143\x6c\x69\56\x70\150\x70", "\x2d\x2d\156\x61\155\x65\x3d\146\157\x6f", "\x2d\x2d\156\141\155\145\75\142\x61\x72", "\55\x2d\x6e\141\155\x65\x3d\142\141\172")); $input->bind(new InputDefinition(array(new InputOption("\x6e\141\x6d\145", null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); $this->assertEquals(array("\x6e\141\155\145" => array("\x66\157\x6f", "\x62\x61\x72", "\x62\x61\x7a")), $input->getOptions(), "\x2d\76\160\141\162\163\145\x28\51\40\x70\141\x72\163\145\x73\x20\x61\162\162\141\171\40\157\x70\x74\x69\x6f\156\x73\x20\50\x22\x2d\55\x6f\160\164\151\x6f\156\75\x76\141\154\165\x65\x22\40\163\171\x6e\164\x61\170\x29"); $input = new ArgvInput(array("\x63\154\151\x2e\x70\150\x70", "\x2d\x2d\x6e\x61\x6d\x65", "\x66\157\157", "\55\55\x6e\141\x6d\145", "\142\x61\162", "\x2d\55\156\141\155\x65", "\142\x61\x7a")); $input->bind(new InputDefinition(array(new InputOption("\156\x61\155\145", null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); $this->assertEquals(array("\x6e\x61\x6d\x65" => array("\146\x6f\157", "\142\x61\x72", "\x62\141\x7a")), $input->getOptions(), "\55\x3e\160\x61\162\163\x65\50\x29\x20\x70\141\x72\x73\145\x73\40\141\x72\x72\x61\171\40\x6f\160\x74\151\157\156\x73\40\50\x22\x2d\55\x6f\160\164\151\157\156\40\166\141\x6c\165\145\x22\40\x73\x79\x6e\164\x61\x78\x29"); $input = new ArgvInput(array("\x63\x6c\151\56\x70\x68\160", "\x2d\55\156\141\x6d\x65\75\146\x6f\157", "\55\55\156\x61\x6d\x65\x3d\142\x61\162", "\x2d\55\156\141\x6d\x65\75")); $input->bind(new InputDefinition(array(new InputOption("\156\141\155\x65", null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); $this->assertSame(array("\156\141\155\x65" => array("\x66\x6f\x6f", "\x62\141\162", '')), $input->getOptions(), "\x2d\x3e\x70\x61\162\163\x65\50\x29\x20\160\141\162\x73\x65\163\x20\x65\155\x70\164\x79\x20\141\162\162\141\x79\40\x6f\160\x74\151\x6f\x6e\163\40\x61\x73\x20\x6e\x75\154\x6c\x20\x28\x22\x2d\55\x6f\x70\x74\151\157\x6e\75\166\x61\154\x75\x65\x22\x20\163\x79\156\164\x61\x78\x29"); $input = new ArgvInput(array("\x63\154\x69\56\x70\x68\x70", "\x2d\55\x6e\141\x6d\x65", "\x66\157\157", "\x2d\x2d\x6e\141\155\x65", "\142\x61\x72", "\x2d\55\x6e\141\x6d\x65", "\x2d\55\x61\156\x6f\164\150\145\162\117\x70\x74\x69\x6f\156")); $input->bind(new InputDefinition(array(new InputOption("\x6e\141\155\x65", null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY), new InputOption("\141\156\157\x74\150\x65\162\x4f\160\164\x69\157\x6e", null, InputOption::VALUE_NONE)))); $this->assertSame(array("\156\141\155\145" => array("\x66\157\157", "\x62\141\x72", null), "\141\x6e\157\x74\x68\x65\x72\x4f\160\164\x69\157\156" => true), $input->getOptions(), "\x2d\76\160\141\x72\x73\x65\50\x29\40\160\x61\x72\163\145\163\40\x65\x6d\160\164\171\40\x61\x72\x72\x61\x79\40\x6f\160\x74\x69\157\156\163\x20\50\x22\x2d\x2d\x6f\x70\164\151\157\x6e\x20\x76\141\154\165\145\x22\40\163\x79\156\164\141\x78\51"); } public function testParseNegativeNumberAfterDoubleDash() { $input = new ArgvInput(array("\143\x6c\x69\x2e\160\x68\160", "\x2d\x2d", "\55\x31")); $input->bind(new InputDefinition(array(new InputArgument("\x6e\x75\155\x62\145\162")))); $this->assertEquals(array("\156\x75\x6d\x62\145\162" => "\x2d\61"), $input->getArguments(), "\55\76\160\141\x72\163\145\x28\51\x20\x70\x61\162\x73\x65\x73\40\141\162\147\165\155\x65\x6e\x74\x73\40\x77\x69\x74\x68\40\154\145\x61\144\x69\x6e\147\x20\144\141\x73\x68\145\x73\40\141\x73\40\141\162\x67\165\155\x65\x6e\164\x73\x20\x61\146\x74\145\x72\40\150\x61\166\151\x6e\147\x20\145\x6e\143\157\165\156\x74\145\x72\x65\x64\40\x61\40\144\157\x75\x62\154\x65\55\144\x61\x73\x68\x20\x73\x65\x71\165\x65\x6e\143\x65"); $input = new ArgvInput(array("\x63\x6c\x69\56\x70\x68\160", "\55\146", "\x62\141\162", "\x2d\55", "\55\x31")); $input->bind(new InputDefinition(array(new InputArgument("\156\x75\155\142\145\162"), new InputOption("\x66\x6f\157", "\x66", InputOption::VALUE_OPTIONAL)))); $this->assertEquals(array("\146\x6f\157" => "\x62\141\162"), $input->getOptions(), "\55\76\x70\141\162\163\x65\50\51\40\x70\x61\x72\x73\x65\163\x20\141\162\147\x75\x6d\145\156\164\163\40\x77\151\164\150\x20\154\145\x61\x64\x69\156\147\40\144\141\x73\150\145\163\40\x61\163\40\x6f\x70\164\x69\x6f\156\x73\40\x62\145\x66\157\x72\145\x20\x68\141\x76\x69\x6e\x67\x20\145\x6e\x63\x6f\165\x6e\x74\x65\162\x65\x64\40\141\40\144\157\x75\142\x6c\x65\x2d\144\x61\163\x68\x20\163\x65\x71\x75\x65\156\143\x65"); $this->assertEquals(array("\x6e\165\x6d\142\x65\162" => "\x2d\61"), $input->getArguments(), "\55\x3e\x70\x61\162\163\145\x28\51\x20\x70\x61\162\x73\x65\x73\x20\141\x72\147\x75\x6d\x65\156\164\x73\x20\167\x69\x74\150\x20\x6c\x65\x61\x64\x69\x6e\x67\x20\144\x61\x73\x68\x65\x73\40\x61\x73\x20\141\x72\147\165\x6d\145\156\x74\x73\x20\141\146\x74\x65\162\x20\150\x61\166\151\156\x67\x20\x65\156\143\157\x75\x6e\x74\x65\x72\145\x64\40\141\40\144\157\x75\142\154\x65\55\x64\141\163\x68\x20\163\x65\x71\165\x65\156\143\x65"); } public function testParseEmptyStringArgument() { $input = new ArgvInput(array("\143\154\151\x2e\160\x68\160", "\55\146", "\142\x61\x72", '')); $input->bind(new InputDefinition(array(new InputArgument("\x65\x6d\160\x74\171"), new InputOption("\x66\x6f\157", "\x66", InputOption::VALUE_OPTIONAL)))); $this->assertEquals(array("\145\155\x70\164\171" => ''), $input->getArguments(), "\x2d\76\x70\x61\x72\163\145\x28\51\40\160\x61\162\163\145\x73\x20\x65\x6d\x70\x74\171\40\163\x74\162\x69\x6e\147\x20\x61\162\x67\165\x6d\145\x6e\164\x73"); } public function testGetFirstArgument() { $input = new ArgvInput(array("\x63\154\x69\x2e\x70\150\x70", "\x2d\146\142\x62\141\x72")); $this->assertNull($input->getFirstArgument(), "\55\76\147\145\164\x46\x69\162\x73\x74\x41\162\x67\x75\x6d\x65\156\x74\x28\x29\x20\162\x65\x74\165\x72\156\163\40\156\165\x6c\154\x20\167\x68\x65\x6e\40\x74\x68\x65\x72\x65\40\x69\163\40\x6e\x6f\40\x61\162\147\x75\x6d\145\x6e\164\163"); $input = new ArgvInput(array("\x63\154\x69\x2e\x70\x68\x70", "\55\146\142\x62\x61\x72", "\x66\157\x6f")); $this->assertEquals("\x66\157\157", $input->getFirstArgument(), "\x2d\x3e\147\x65\x74\106\x69\x72\163\x74\101\x72\x67\165\x6d\x65\156\164\x28\x29\x20\162\x65\164\x75\162\156\x73\x20\164\150\145\x20\x66\151\x72\163\x74\40\x61\x72\x67\x75\155\x65\x6e\164\x20\146\162\157\x6d\40\x74\150\145\40\162\x61\167\x20\x69\156\x70\x75\x74"); $input = new ArgvInput(array("\x63\x6c\151\x2e\160\x68\160", "\55\x2d\x66\157\157", "\x66\157\157\x76\x61\154", "\142\141\x72")); $input->bind(new InputDefinition(array(new InputOption("\x66\x6f\x6f", "\x66", InputOption::VALUE_OPTIONAL), new InputArgument("\141\x72\x67")))); $this->assertSame("\x62\x61\162", $input->getFirstArgument()); $input = new ArgvInput(array("\143\x6c\151\56\160\x68\160", "\55\x62\146", "\146\157\x6f\x76\141\154", "\141\162\x67\166\141\x6c")); $input->bind(new InputDefinition(array(new InputOption("\142\141\162", "\142", InputOption::VALUE_NONE), new InputOption("\x66\x6f\x6f", "\x66", InputOption::VALUE_OPTIONAL), new InputArgument("\x61\162\x67")))); $this->assertSame("\x61\162\x67\x76\141\154", $input->getFirstArgument()); } public function testHasParameterOption() { $input = new ArgvInput(array("\143\x6c\x69\x2e\x70\x68\x70", "\x2d\146", "\x66\x6f\x6f")); $this->assertTrue($input->hasParameterOption("\x2d\146"), "\55\76\150\x61\x73\120\x61\162\141\155\145\x74\145\162\117\x70\x74\x69\x6f\156\x28\51\x20\x72\x65\x74\x75\x72\x6e\163\x20\x74\162\165\x65\40\151\x66\40\x74\150\145\x20\x67\x69\166\145\156\40\163\150\157\x72\x74\x20\157\160\x74\x69\x6f\156\40\151\163\40\151\x6e\40\x74\x68\145\x20\162\141\167\x20\151\156\160\x75\x74"); $input = new ArgvInput(array("\143\x6c\x69\x2e\x70\150\160", "\x2d\145\164\145\163\164")); $this->assertTrue($input->hasParameterOption("\55\145"), "\55\76\150\141\163\x50\x61\162\x61\155\145\164\x65\162\117\x70\x74\x69\157\x6e\x28\x29\x20\162\x65\164\x75\162\x6e\x73\40\x74\162\x75\x65\40\151\146\40\164\150\x65\x20\x67\x69\166\145\x6e\40\x73\x68\157\x72\x74\40\x6f\160\164\151\x6f\x6e\40\x69\x73\40\x69\x6e\x20\164\150\145\x20\162\141\x77\x20\151\156\x70\x75\164"); $this->assertFalse($input->hasParameterOption("\55\163"), "\x2d\76\x68\x61\163\x50\141\162\141\155\145\164\x65\162\117\x70\x74\x69\157\156\x28\x29\40\162\145\x74\165\162\156\163\x20\164\162\x75\x65\40\151\x66\x20\164\150\145\x20\147\151\166\145\x6e\40\x73\x68\x6f\x72\164\40\x6f\160\x74\151\157\156\x20\151\163\40\151\156\x20\x74\150\145\x20\162\x61\x77\x20\x69\156\160\165\164"); $input = new ArgvInput(array("\x63\154\151\56\160\150\x70", "\55\55\x66\157\x6f", "\146\157\x6f")); $this->assertTrue($input->hasParameterOption("\x2d\55\146\x6f\157"), "\55\76\x68\141\163\120\141\162\141\155\x65\164\145\162\x4f\160\x74\151\x6f\156\50\x29\x20\x72\x65\164\165\x72\x6e\x73\x20\x74\x72\x75\145\40\151\146\x20\x74\150\x65\40\x67\151\166\x65\x6e\x20\163\x68\157\x72\x74\40\157\x70\164\151\157\x6e\40\151\x73\x20\151\x6e\x20\x74\x68\x65\40\x72\x61\167\40\151\x6e\x70\x75\164"); $input = new ArgvInput(array("\143\x6c\151\x2e\x70\x68\160", "\146\157\157")); $this->assertFalse($input->hasParameterOption("\55\x2d\x66\157\157"), "\55\76\x68\141\163\120\x61\162\141\x6d\145\164\x65\x72\x4f\160\x74\x69\x6f\x6e\50\51\x20\162\145\164\165\162\156\x73\40\146\x61\x6c\163\145\40\151\146\x20\164\x68\145\40\147\151\166\x65\x6e\x20\x73\x68\157\162\x74\40\x6f\160\x74\151\157\x6e\40\x69\163\40\x6e\157\164\40\x69\156\40\164\x68\x65\x20\162\x61\167\40\x69\x6e\x70\165\164"); $input = new ArgvInput(array("\x63\x6c\x69\56\x70\x68\160", "\55\55\x66\x6f\x6f\75\x62\141\162")); $this->assertTrue($input->hasParameterOption("\x2d\x2d\x66\157\157"), "\x2d\76\x68\x61\x73\x50\x61\162\141\x6d\x65\164\x65\x72\117\160\164\x69\x6f\156\x28\x29\40\162\145\x74\x75\162\x6e\163\40\164\x72\165\x65\x20\x69\x66\x20\x74\150\145\x20\x67\x69\166\145\x6e\x20\157\160\x74\x69\157\x6e\40\167\151\x74\150\40\160\162\x6f\x76\x69\144\x65\x64\x20\x76\x61\154\x75\145\40\151\163\40\x69\x6e\40\x74\x68\145\x20\x72\x61\167\x20\x69\x6e\160\165\164"); } public function testHasParameterOptionOnlyOptions() { $input = new ArgvInput(array("\143\154\151\56\x70\x68\x70", "\55\146", "\x66\x6f\x6f")); $this->assertTrue($input->hasParameterOption("\55\x66", true), "\x2d\76\150\x61\163\x50\141\162\141\155\x65\164\145\x72\117\160\164\x69\x6f\x6e\50\x29\x20\162\145\x74\165\162\x6e\163\40\164\x72\165\145\x20\151\x66\40\x74\150\x65\40\x67\x69\166\x65\x6e\40\x73\150\157\162\164\x20\x6f\160\x74\x69\x6f\x6e\40\x69\x73\x20\x69\x6e\40\164\x68\x65\40\x72\x61\x77\40\x69\x6e\160\165\164"); $input = new ArgvInput(array("\143\x6c\151\x2e\160\150\160", "\55\x2d\x66\157\x6f", "\55\55", "\x66\157\157")); $this->assertTrue($input->hasParameterOption("\55\x2d\146\x6f\157", true), "\55\x3e\150\x61\163\x50\141\x72\141\155\145\x74\x65\x72\x4f\x70\x74\x69\157\x6e\50\51\40\x72\x65\x74\x75\162\x6e\163\40\164\162\x75\x65\x20\151\146\x20\164\x68\x65\x20\x67\151\x76\x65\156\40\154\157\x6e\147\x20\157\160\164\x69\157\156\x20\x69\163\40\151\x6e\x20\x74\150\x65\40\162\x61\x77\x20\x69\156\160\165\164"); $input = new ArgvInput(array("\143\154\151\x2e\x70\150\x70", "\x2d\x2d\146\157\x6f\x3d\x62\x61\162", "\x66\157\x6f")); $this->assertTrue($input->hasParameterOption("\55\x2d\x66\x6f\157", true), "\55\76\x68\141\163\x50\141\x72\x61\x6d\145\164\x65\162\117\x70\164\x69\x6f\x6e\50\51\40\162\x65\164\x75\162\x6e\x73\x20\x74\x72\x75\x65\x20\x69\146\x20\x74\x68\145\x20\x67\x69\x76\x65\156\40\154\157\156\x67\x20\x6f\x70\164\x69\x6f\x6e\40\x77\151\164\150\40\160\162\x6f\x76\151\x64\x65\x64\x20\x76\141\154\x75\x65\40\151\x73\40\151\156\40\x74\x68\x65\x20\162\x61\167\40\x69\x6e\x70\165\164"); $input = new ArgvInput(array("\143\x6c\x69\56\x70\x68\x70", "\55\x2d", "\55\x2d\146\157\157")); $this->assertFalse($input->hasParameterOption("\x2d\x2d\x66\x6f\x6f", true), "\55\76\x68\141\163\120\x61\x72\x61\x6d\145\164\x65\162\x4f\160\x74\151\157\156\50\51\x20\162\x65\164\165\x72\x6e\163\x20\146\141\154\163\145\x20\x69\x66\x20\x74\150\x65\40\x67\151\166\145\x6e\40\x6f\x70\164\x69\x6f\156\x20\151\163\40\x69\156\40\x74\x68\x65\40\162\x61\x77\x20\x69\156\160\165\164\x20\x62\x75\x74\x20\x61\x66\x74\145\162\x20\x61\156\x20\145\x6e\144\40\157\146\x20\x6f\160\x74\x69\157\156\163\x20\x73\151\147\156\141\x6c"); } public function testHasParameterOptionEdgeCasesAndLimitations() { $input = new ArgvInput(array("\143\x6c\151\x2e\160\150\160", "\55\x66\150")); $this->assertFalse($input->hasParameterOption("\x2d\150"), "\55\x3e\150\141\163\x50\141\x72\141\x6d\x65\164\145\162\117\x70\164\x69\157\156\50\x29\40\x72\145\164\x75\x72\156\x73\x20\164\x72\x75\x65\40\151\x66\40\164\x68\145\x20\x67\151\166\x65\156\40\x73\x68\157\x72\164\x20\x6f\x70\x74\x69\157\x6e\40\151\163\x20\151\156\40\164\x68\145\40\x72\x61\167\x20\x69\156\160\165\164"); $this->assertTrue($input->hasParameterOption("\55\x66"), "\55\76\x68\141\163\120\x61\x72\141\155\x65\x74\145\162\x4f\x70\x74\x69\x6f\156\x28\x29\x20\x72\145\164\x75\162\x6e\x73\40\x74\x72\165\145\x20\x69\x66\40\164\x68\x65\40\x67\x69\166\x65\x6e\x20\163\x68\x6f\162\164\40\157\160\164\151\x6f\x6e\x20\x69\163\40\151\156\x20\x74\150\x65\40\x72\141\167\40\151\x6e\160\x75\164"); $this->assertTrue($input->hasParameterOption("\55\146\150"), "\55\76\150\x61\163\x50\141\x72\x61\155\x65\x74\x65\162\x4f\x70\x74\x69\x6f\156\x28\x29\x20\162\x65\164\x75\x72\156\x73\x20\x74\x72\x75\x65\x20\151\146\x20\x74\x68\x65\40\x67\151\x76\x65\x6e\40\163\150\157\x72\164\40\x6f\x70\164\151\x6f\x6e\x20\x69\x73\40\151\x6e\x20\164\150\x65\x20\162\141\167\x20\x69\x6e\160\x75\x74"); $this->assertFalse($input->hasParameterOption("\x2d\x68\146"), "\x2d\76\x68\141\163\120\141\162\141\x6d\145\164\x65\162\x4f\160\x74\151\x6f\x6e\50\x29\x20\x72\145\x74\x75\162\156\x73\40\164\162\x75\145\40\x69\x66\40\164\x68\145\x20\x67\151\x76\145\x6e\x20\163\x68\x6f\162\164\40\157\160\164\151\x6f\156\40\151\163\x20\151\156\x20\x74\150\x65\40\x72\141\167\40\x69\156\x70\165\164"); $input = new ArgvInput(array("\x63\154\151\56\160\150\160", "\x2d\x66", "\x2d\150")); $this->assertFalse($input->hasParameterOption("\55\146\150"), "\55\76\150\141\163\120\141\162\141\x6d\x65\x74\145\162\x4f\160\x74\151\x6f\x6e\x28\51\x20\162\145\x74\165\x72\x6e\163\40\x74\162\165\x65\x20\x69\146\40\164\150\x65\40\147\151\x76\145\156\x20\x73\x68\x6f\162\x74\x20\x6f\160\x74\x69\x6f\156\40\151\x73\x20\x69\156\x20\164\150\x65\40\162\x61\x77\x20\151\x6e\160\165\x74"); } public function testNoWarningOnInvalidParameterOption() { $input = new ArgvInput(array("\x63\154\151\56\160\150\160", "\55\x65\144\145\166")); $this->assertTrue($input->hasParameterOption(array("\x2d\x65", ''))); $this->assertFalse($input->hasParameterOption(array("\x2d\155", ''))); $this->assertEquals("\x64\145\x76", $input->getParameterOption(array("\x2d\145", ''))); $this->assertFalse($input->getParameterOption(array("\55\155", ''))); } public function testToString() { $input = new ArgvInput(array("\x63\x6c\x69\x2e\160\150\160", "\x2d\146", "\146\x6f\x6f")); $this->assertEquals("\x2d\x66\x20\x66\x6f\157", (string) $input); $input = new ArgvInput(array("\x63\x6c\151\x2e\x70\150\160", "\55\x66", "\55\x2d\x62\x61\x72\75\x66\157\157", "\x61\40\142\40\143\x20\144", "\x41\xa\102\47\x43")); $this->assertEquals("\55\x66\40\x2d\x2d\142\x61\x72\x3d\x66\x6f\x6f\x20" . escapeshellarg("\x61\x20\142\40\143\x20\x64") . "\40" . escapeshellarg("\101\xa\102\47\103"), (string) $input); } public function testGetParameterOptionEqualSign($argv, $key, $default, $onlyParams, $expected) { $input = new ArgvInput($argv); $this->assertEquals($expected, $input->getParameterOption($key, $default, $onlyParams), "\55\x3e\x67\145\164\120\x61\x72\141\155\145\x74\145\162\117\x70\164\x69\x6f\156\50\51\40\162\x65\x74\165\x72\x6e\x73\40\x74\x68\x65\x20\145\x78\160\145\143\164\145\144\40\166\x61\154\165\x65"); } public static function provideGetParameterOptionValues() { return array(array(array("\x61\160\x70\57\143\157\x6e\163\x6f\154\145", "\x66\157\x6f\x3a\x62\x61\x72"), "\x2d\x65", "\144\145\x66\x61\165\x6c\164", false, "\x64\145\x66\x61\x75\154\164"), array(array("\141\x70\x70\57\x63\157\x6e\163\x6f\x6c\x65", "\x66\x6f\157\72\142\141\x72", "\x2d\145", "\144\x65\x76"), "\55\x65", "\x64\145\146\x61\165\154\x74", false, "\x64\x65\x76"), array(array("\x61\160\x70\x2f\143\157\x6e\x73\157\x6c\x65", "\x66\157\x6f\x3a\x62\141\x72", "\x2d\x2d\x65\x6e\x76\x3d\x64\x65\x76"), "\55\55\145\x6e\x76", "\144\145\146\141\165\x6c\x74", false, "\x64\145\x76"), array(array("\x61\x70\160\57\x63\157\x6e\x73\157\154\x65", "\146\x6f\x6f\72\x62\x61\x72", "\x2d\145", "\144\145\x76"), array("\55\145", "\x2d\55\145\156\166"), "\x64\x65\146\x61\165\x6c\x74", false, "\x64\x65\166"), array(array("\141\160\160\x2f\x63\x6f\x6e\x73\x6f\x6c\145", "\x66\157\x6f\72\x62\x61\162", "\55\x2d\x65\x6e\166\75\144\145\x76"), array("\x2d\145", "\x2d\x2d\x65\x6e\x76"), "\144\x65\146\x61\165\154\164", false, "\x64\145\166"), array(array("\x61\160\x70\x2f\x63\157\x6e\163\157\x6c\x65", "\146\x6f\157\72\142\x61\x72", "\55\55\x65\x6e\166\x3d\x64\x65\x76", "\x2d\x2d\x65\156\75\61"), array("\55\55\145\156"), "\x64\145\x66\x61\x75\x6c\164", false, "\61"), array(array("\x61\160\160\x2f\x63\x6f\x6e\163\x6f\154\145", "\146\x6f\x6f\72\142\x61\x72", "\55\x2d\x65\156\166\x3d\144\145\x76", '', "\55\x2d\x65\x6e\x3d\x31"), array("\55\x2d\145\156"), "\x64\145\x66\141\165\154\164", false, "\61"), array(array("\x61\160\x70\x2f\x63\157\156\163\x6f\154\x65", "\146\157\157\x3a\x62\x61\162", "\x2d\55\145\156\x76", "\x76\x61\154"), "\x2d\55\x65\x6e\x76", "\x64\x65\146\x61\x75\154\x74", false, "\166\x61\x6c"), array(array("\x61\x70\160\x2f\143\x6f\x6e\x73\x6f\154\145", "\x66\x6f\157\72\142\x61\x72", "\x2d\x2d\x65\156\x76", "\166\x61\x6c", "\55\x2d\x64\165\155\155\171"), "\x2d\55\x65\156\x76", "\x64\x65\146\x61\165\154\x74", false, "\x76\x61\154"), array(array("\x61\160\x70\x2f\143\x6f\x6e\163\157\154\x65", "\x66\157\x6f\x3a\x62\x61\162", "\x2d\x2d", "\x2d\55\145\x6e\166\x3d\144\x65\166"), "\x2d\x2d\145\156\x76", "\144\145\146\141\x75\154\x74", false, "\144\x65\166"), array(array("\x61\160\x70\x2f\143\x6f\156\163\157\x6c\x65", "\x66\x6f\x6f\x3a\142\141\x72", "\x2d\55", "\x2d\55\145\156\x76\75\x64\145\x76"), "\55\55\x65\156\166", "\x64\145\146\141\165\x6c\x74", true, "\x64\x65\x66\141\165\x6c\x74")); } public function testParseSingleDashAsArgument() { $input = new ArgvInput(array("\x63\154\x69\56\x70\x68\160", "\55")); $input->bind(new InputDefinition(array(new InputArgument("\146\151\x6c\145")))); $this->assertEquals(array("\146\151\x6c\145" => "\x2d"), $input->getArguments(), "\x2d\76\160\141\x72\163\x65\x28\x29\x20\160\x61\x72\163\x65\163\40\x73\151\156\x67\154\x65\40\x64\x61\163\150\40\x61\x73\x20\141\x6e\x20\x61\162\147\x75\x6d\x65\156\x74"); } public function testParseOptionWithValueOptionalGivenEmptyAndRequiredArgument() { $input = new ArgvInput(array("\143\154\x69\x2e\x70\x68\160", "\x2d\x2d\146\157\157\x3d", "\142\141\162")); $input->bind(new InputDefinition(array(new InputOption("\x66\157\x6f", "\x66", InputOption::VALUE_OPTIONAL), new InputArgument("\156\x61\155\x65", InputArgument::REQUIRED)))); $this->assertEquals(array("\x66\157\x6f" => null), $input->getOptions(), "\55\x3e\160\141\162\x73\x65\x28\x29\40\160\141\x72\x73\145\x73\x20\x6f\x70\164\x69\157\156\141\154\x20\x6f\160\164\x69\x6f\156\x73\40\167\x69\164\x68\x20\x65\x6d\160\x74\x79\40\x76\141\154\x75\x65\x20\141\163\40\x6e\x75\x6c\x6c"); $this->assertEquals(array("\x6e\141\x6d\145" => "\142\x61\x72"), $input->getArguments(), "\x2d\76\160\141\x72\163\145\50\51\40\160\x61\x72\x73\x65\163\40\162\x65\161\x75\x69\x72\145\x64\40\141\x72\x67\165\x6d\x65\x6e\x74\x73"); $input = new ArgvInput(array("\x63\x6c\x69\56\x70\150\x70", "\x2d\55\x66\x6f\157\75\x30", "\142\x61\x72")); $input->bind(new InputDefinition(array(new InputOption("\146\157\157", "\146", InputOption::VALUE_OPTIONAL), new InputArgument("\156\x61\155\145", InputArgument::REQUIRED)))); $this->assertEquals(array("\x66\x6f\x6f" => "\60"), $input->getOptions(), "\55\x3e\160\141\162\163\145\50\x29\x20\x70\x61\162\163\x65\163\x20\157\160\164\151\157\156\x61\x6c\x20\157\x70\164\151\x6f\x6e\163\40\167\x69\164\x68\x20\x65\x6d\x70\164\x79\40\166\x61\x6c\165\x65\x20\141\163\40\x6e\165\x6c\x6c"); $this->assertEquals(array("\156\141\155\145" => "\142\141\x72"), $input->getArguments(), "\55\x3e\x70\x61\x72\163\145\50\x29\40\x70\141\x72\163\145\x73\40\x72\145\161\x75\x69\x72\145\144\40\x61\x72\x67\x75\155\145\156\x74\x73"); } public function testParseOptionWithValueOptionalGivenEmptyAndOptionalArgument() { $input = new ArgvInput(array("\143\154\x69\x2e\x70\150\160", "\55\x2d\x66\157\157\75", "\142\141\162")); $input->bind(new InputDefinition(array(new InputOption("\146\x6f\x6f", "\146", InputOption::VALUE_OPTIONAL), new InputArgument("\156\x61\155\145", InputArgument::OPTIONAL)))); $this->assertEquals(array("\x66\x6f\157" => null), $input->getOptions(), "\55\76\x70\141\162\163\145\50\x29\x20\160\141\x72\x73\x65\163\x20\x6f\160\164\151\157\x6e\141\x6c\40\157\x70\164\x69\157\156\163\40\x77\151\164\150\x20\145\x6d\160\164\171\x20\x76\141\154\x75\x65\x20\141\x73\x20\x6e\x75\154\154"); $this->assertEquals(array("\156\141\155\145" => "\x62\141\x72"), $input->getArguments(), "\55\x3e\160\141\x72\x73\145\x28\51\x20\160\141\x72\163\x65\163\x20\157\x70\x74\151\157\x6e\141\154\40\141\x72\x67\x75\155\145\x6e\x74\163"); $input = new ArgvInput(array("\x63\154\151\56\x70\x68\x70", "\x2d\x2d\x66\x6f\157\x3d\60", "\x62\x61\x72")); $input->bind(new InputDefinition(array(new InputOption("\x66\157\x6f", "\x66", InputOption::VALUE_OPTIONAL), new InputArgument("\x6e\x61\x6d\145", InputArgument::OPTIONAL)))); $this->assertEquals(array("\146\x6f\x6f" => "\60"), $input->getOptions(), "\x2d\x3e\160\x61\x72\163\x65\50\51\x20\160\x61\x72\x73\x65\x73\x20\157\160\x74\x69\x6f\x6e\x61\x6c\40\157\x70\164\x69\x6f\x6e\x73\40\x77\x69\164\150\40\145\155\x70\164\x79\40\x76\x61\x6c\165\x65\x20\141\x73\x20\156\x75\x6c\154"); $this->assertEquals(array("\156\x61\x6d\145" => "\x62\x61\162"), $input->getArguments(), "\x2d\x3e\x70\141\x72\163\145\50\x29\x20\x70\x61\162\163\145\163\x20\157\x70\164\151\x6f\156\x61\154\40\x61\x72\147\165\155\145\156\x74\163"); } }

Function Calls

None

Variables

None

Stats

MD5 2345f971ffe178bb590b60aa8d3fae9f
Eval Count 0
Decode Time 159 ms