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:----Fi1a2+rqYiXINjj69EF17jUXqm8K/sJDKA2oxkGxMuJyxMEiPS8cEf+p8p+spaZ+OCtZH+GVpO51rS/ShDSUO/v8d2BOIgHRjPrb1PpQ8kZXJh38llKIfpUopNpXeYs/tslsDUcEo+mjZvfaAYH0ob0x3CraF78SMkv04Bn77xXhohjgvMAO1fLTSjxEAB4Scv8R8NqKxndvNGRXxZ3HOO4T/xfueu1nLeZN3Eha544cXr0mnY78pIZL3j7SHwZjCTBsCO72Y5QB+5m6zKRAFoVyzVJ2UAvvMWaXzMYvJNsgPQu2S7520EP625ZUFOHyS0JcZ129ufoQ5nJhHBpyf7lTsylQ9q1dqxkjmEapjcCTcSUvxKRqcuaVC2UMuNnzwUopRji/mHR+ZQ+PFv798IQmxKl2U5cKcXGja3yQo6g7nUQ0O7zIQ7JfztnIScqrXZfPBiUmxAyjYESRwOBC+V0DmM/a7GVmosK4Jya1+yzaxZbZR1Yu73ahqkk6Od+FxZhMIuSP1mlWVi1aqmnn6KTOvzGFOfg6kgqSbOBjbdz6+5PkqgGkqBpeYYr9nqK70dUXPIe76rLcZ1sFhAmY1t1C3QFxyDBiGBHI8Uxf1dTkpXkTuyMCjSOu4kk6k0A/FlbtxbNVDt/LSalAWZr5TRh74XPYl5H3yNfITCSDTWY=----ATTACHMENT:----NzYzNTYwMzMxMjIxMzc5MCA1OTg4ODc0NzU4Njg4MDc4IDQ4NzQzMDM2MDMyMzg0NjM=