Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Service] Adding removeParam() to ApiCommand

  • Loading branch information...
commit 03184125383caa148e13748f10886c1501661e39 1 parent ddc7e05
@mtdowling mtdowling authored
View
14 src/Guzzle/Service/Description/ApiCommand.php
@@ -268,6 +268,20 @@ public function addParam(ApiParam $param)
}
/**
+ * Remove a parameter from the command
+ *
+ * @param string $name Name of the parameter to remove
+ *
+ * @return self
+ */
+ public function removeParam($name)
+ {
+ unset($this->params[$name]);
+
+ return $this;
+ }
+
+ /**
* {@inheritdoc}
*/
public function getMethod()
View
14 tests/Guzzle/Tests/Service/Description/ApiCommandTest.php
@@ -385,4 +385,18 @@ public function testCanBuildUpCommands()
$this->assertEquals('/foo/bar', $c->getUri());
$this->assertEquals(array('test'), $c->getParamNames());
}
+
+ /**
+ * @covers Guzzle\Service\Description\ApiCommand::removeParam
+ */
+ public function testCanRemoveParams()
+ {
+ $c = new ApiCommand(array());
+ $c->addParam(new ApiParam(array(
+ 'name' => 'foo'
+ )));
+ $this->assertTrue($c->hasParam('foo'));
+ $c->removeParam('foo');
+ $this->assertFalse($c->hasParam('foo'));
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.