public function DefinitionTest::testMethodCalls in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php \Symfony\Component\DependencyInjection\Tests\DefinitionTest::testMethodCalls()
@covers Symfony\Component\DependencyInjection\Definition::setMethodCalls @covers Symfony\Component\DependencyInjection\Definition::addMethodCall @covers Symfony\Component\DependencyInjection\Definition::hasMethodCall @covers Symfony\Component\DependencyInjection\Definition::removeMethodCall
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ DefinitionTest.php, line 96
Class
Namespace
Symfony\Component\DependencyInjection\TestsCode
public function testMethodCalls() {
$def = new Definition('stdClass');
$this
->assertSame($def, $def
->setMethodCalls(array(
array(
'foo',
array(
'foo',
),
),
)), '->setMethodCalls() implements a fluent interface');
$this
->assertEquals(array(
array(
'foo',
array(
'foo',
),
),
), $def
->getMethodCalls(), '->getMethodCalls() returns the methods to call');
$this
->assertSame($def, $def
->addMethodCall('bar', array(
'bar',
)), '->addMethodCall() implements a fluent interface');
$this
->assertEquals(array(
array(
'foo',
array(
'foo',
),
),
array(
'bar',
array(
'bar',
),
),
), $def
->getMethodCalls(), '->addMethodCall() adds a method to call');
$this
->assertTrue($def
->hasMethodCall('bar'), '->hasMethodCall() returns true if first argument is a method to call registered');
$this
->assertFalse($def
->hasMethodCall('no_registered'), '->hasMethodCall() returns false if first argument is not a method to call registered');
$this
->assertSame($def, $def
->removeMethodCall('bar'), '->removeMethodCall() implements a fluent interface');
$this
->assertEquals(array(
array(
'foo',
array(
'foo',
),
),
), $def
->getMethodCalls(), '->removeMethodCall() removes a method to call');
}