Permalink
Browse files

Merge branch 'feature/3965' into develop

Close #3965
  • Loading branch information...
2 parents a21a096 + 466269d commit f3a579b285ba92597b314b43ad2190e3729d6d14 @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;
}
@@ -628,6 +628,22 @@ public function getMethod($methodName)
/**
* @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
*/
public function hasMethod($methodName)
@@ -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 f3a579b

Please sign in to comment.