diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 349b2ed5ab..f07c0c5bcf 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -392,7 +392,6 @@ class Definition foreach ($this->calls as $i => $call) { if ($call[0] === $method) { unset($this->calls[$i]); - break; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php index 0a46e5795c..d03233f5d2 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php @@ -425,4 +425,20 @@ class DefinitionTest extends TestCase $def->addError('Second error'); $this->assertSame(['First error', 'Second error'], $def->getErrors()); } + + public function testMultipleMethodCalls() + { + $def = new Definition('stdClass'); + + $def->addMethodCall('configure', ['arg1']); + $this->assertTrue($def->hasMethodCall('configure')); + $this->assertCount(1, $def->getMethodCalls()); + + $def->addMethodCall('configure', ['arg2']); + $this->assertTrue($def->hasMethodCall('configure')); + $this->assertCount(2, $def->getMethodCalls()); + + $def->removeMethodCall('configure'); + $this->assertFalse($def->hasMethodCall('configure')); + } }