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:----lM7gc+UURQrvAkQ7a791dj8hq6K/R4KotifMj2OmNs4LJkOttCYyZwTVFs2n5yMu2d7ILWOR3V8k5I7cr/aA7aumos77w0zSjD9VD3XU565qzO+ihnx7YM45ljyq71stAYsqsRAzO/pT1yxcZtzazI/Uk46AwF513JGuN9pRBiVWyA7TJkz5OLYAyKUrPPlr8YqCng7sb2bKUF7Z54r1Cpy8fCJH2p7epKEDOYqjt1BGm1iR56fxO8KejzBXYxsUpfiorbQF50hgNQrfUA3xNgzR/w411iNZTvOID3ULsvaJBVCGSv5u5Ltqz2yT4mKiOwTB8XEY0wPC0e044weaaBdJf5OleFwmZV56uW+x7EIVqmV066AJ8XLj92dcGhbWPzJ8ojchAAgNjdPbukuBKaTnNssA5/3xptrGdhT7J2pmTGDqHFsFLJqE56pKFLySRJBF9P8IHGiLfK4tgndeeG1N9IH305UgnyHfudDU1ICMMSzy44wW0zjOYg3Gny83kCpNY9LPZRhIO2zesDMOk8fNRQ+7o1nAanPBlbIomsIIxgP9VAnsBCIdLUDBcebg+qD8Wy4LCcrOjh9hK/Ji664nNAJoHKUPem0nJpGo4qsaAqZR25Z/Ez1s/qJP5zwmKOsmZ/vCCqksv4/TWtjor0cy+hxzWggtT0OSZeC6FFM=----ATTACHMENT:----ODk4OTcxMjkwODIzMTgwOSA4MDI4MDY5NjkzMjI1NTIxIDQxNTMzMjAzNzk4NTY2MTI=