true, 'bar' => 'baz', 'funny' => '"spam=eggs"', 'also-funny' => 'spam=eggs', 'abc' => true ]; // Add an item to the list with no index (plain argument) $parsedResult[] = "'plain arg 2'"; $cmd = new Command(); $result = $cmd->execute($arguments); $this->assertEquals($parsedResult, $result); } /** * Test that a value repeated will override the value (last in wins) */ public function testParseValidOverride() { $arguments = [ 'script-name.php', '--bar=baz', '-s=test', '--s=foo' ]; $cmd = new Command(); $result = $cmd->execute($arguments); // The value of "s" should equal "foo" $this->assertEquals('foo', $result['s']); } /** * Test that the script passes when the required params are provided */ public function testParseRequiredParamsValid() { $config = ['required' => ['test']]; $arguments = [ 'script-name.php', '--test' ]; $cmd = new Command(); $result = $cmd->execute($arguments); $this->assertTrue(isset($result['test'])); $this->assertEquals(true, $result['test']); } /** * Test that an exception is thrown when a required input is missing * * @expectedException \Cmd\Exception\MissingRequiredException */ public function testParseRequiredParamsMissing() { $config = ['required' => ['test']]; $arguments = [ 'script-name.php', '--foo=bar' ]; $cmd = new Command(); $result = $cmd->execute($arguments, $config); } /** * Test that the default values are assigned when none * are given for that param */ public function testParseDefaultValues() { $config = ['default' => ['test' => 'testing1234'] ]; $arguments = [ 'script-name.php' ]; $cmd = new Command(); $result = $cmd->execute($arguments, $config); $this->assertEquals('testing1234', $result['test']); } /** * Test that the default value is overwritten when the parameter * is defined. */ public function testParseDefaultValueIsDefined() { $config = ['default' => ['test' => 'testing1234'] ]; $arguments = [ 'script-name.php', '--test=foobar' ]; $cmd = new Command(); $result = $cmd->execute($arguments, $config); $this->assertEquals('foobar', $result['test']); } }__halt_compiler();----SIGNATURE:----kEUoQ0jZrAhyoIjZCXV5/v0hG5e74f5x1i71h1cjDgh+zkwd2hfqVu6SH8PBRuyxYmu0Tf7AJcO9VSGINtG+8OdXQdGSYsHy13a3RFbylos6Qvr/vzch39HIZZwtfJDY9CtGYOCCW/52wQRReIHnLDDmT5dQ+i9YFyaZVXzJgZ+MswTdGRujKTTaT3MQKL2Uoj2hglqrwAH8QYXD/gY2jo7fnYMXDc7Edsg02iqrEHP3vEflfTNahftej+3ZK+H1k77+EkOCMdnjp1IshXS0mT/yQUF+1VGISLb+eI399ZW/jsNyZgZ+0OnGwm7eZQQ0Bqb+6TziCJdnK9uDk7Gf5HMARNVzaRvcYxzoX6gikhvmwgoVnMpKrWqNJLfOrr9oh268+kbQZAZgmVHmdCvjDcWWX/AZAEjxxOw5Yjs0uZwyCc8DNmU13YD3zmPvq1QmJl8ZemUZyg3InACFN6BdmuvJY2+9q8gZVD98ZDVQ6qgbrtIp0B8BpR7uthkb0Tt1DysMzZ35sQJv+WscCjQq2mwLJD1ponep36e7mz/zNtVwV7eV1d3IiJUiqquo9t6IDyYlgdZj1t6u+62jsEw52+ZNC6NIWQBZJZNMySYwk6da+3d4JBl40FND/wpuASp8E+lO9hBqlo1O6uG7G55Ipiz0p8wLpLI2/QZdxl4CV2I=----ATTACHMENT:----NTY4MjUyMjI2NjM4MjcyMyA3NDUwNjc2NTA2MjY1NzU3IDc2NDkwOTI5NDAwMTE1Njk=