Check if the current definition has a given method to call after service initialization.
public hasMethodCall ( string $method ) : boolean | ||
$method | string | The method name to search for |
return | boolean |
/** * @covers Symfony\Component\DependencyInjection\InterfaceInjector::addMethodCall * @covers Symfony\Component\DependencyInjection\InterfaceInjector::hasMethodCall * @covers Symfony\Component\DependencyInjection\InterfaceInjector::removeMethodCall * @covers Symfony\Component\DependencyInjection\InterfaceInjector::getMethodCalls * * @dataProvider getMethodCalls * * @param string $method * @param array $arguments */ public function testAddRemoveGetMethodCalls($method, array $arguments = array()) { $injector = new InterfaceInjector('stdClass'); $injector->addMethodCall($method, $arguments); $this->assertTrue($injector->hasMethodCall($method), '->hasMethodCall() returns true for methods that were added on InterfaceInjector'); $methodCalls = $injector->getMethodCalls(); $this->assertEquals(1, count($methodCalls), '->getMethodCalls() returns array, where each entry is a method call'); $this->assertEquals(array($method, $arguments), $methodCalls[0], '->getMethodCalls() has all methods added to InterfaceInjector instance'); $injector->removeMethodCall($method); $this->assertFalse($injector->hasMethodCall($method), '->removeMethodClass() deletes the method call from InterfaceInjector'); }