Permalink
Browse files

Merge branch 'feature/3965' into develop

Close #3965
  • Loading branch information...
2 parents babe00b + 3be3d07 commit c7456ed5966162d806359af8fa8dff389880dabf @weierophinney weierophinney committed Mar 12, 2013
@@ -617,7 +617,7 @@ public function getMethods()
*/
public function getMethod($methodName)
{
- foreach ($this->getMethods() as $method) {
+ foreach ($this->methods as $method) {
if ($method->getName() == $methodName) {
return $method;
}
@@ -626,6 +626,22 @@ public function getMethod($methodName)
return false;
}
+ /**
+ * @param string $methodName
+ * @return ClassGenerator
+ */
+ public function removeMethod($methodName)
+ {
+ foreach ($this->methods as $key => $method) {
+ if ($method->getName() == $methodName) {
+ unset($this->methods[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
/**
* @param string $methodName
* @return bool
@@ -173,6 +173,16 @@ public function testHasMethod()
$this->assertTrue($classGenerator->hasMethod('methodOne'));
}
+ public function testRemoveMethod()
+ {
+ $classGenerator = new ClassGenerator();
+ $classGenerator->addMethod('methodOne');
+ $this->assertTrue($classGenerator->hasMethod('methodOne'));
+
+ $classGenerator->removeMethod('methodOne');
+ $this->assertFalse($classGenerator->hasMethod('methodOne'));
+ }
+
/**
* @group ZF-7361
*/

0 comments on commit c7456ed

Please sign in to comment.