You are here

public function ContainerBuilderTest::testCreateServiceMethodCalls in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testCreateServiceMethodCalls()

@covers Symfony\Component\DependencyInjection\ContainerBuilder::createService

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php, line 382

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testCreateServiceMethodCalls() {
  $builder = new ContainerBuilder();
  $builder
    ->register('bar', 'stdClass');
  $builder
    ->register('foo1', 'Bar\\FooClass')
    ->addMethodCall('setBar', array(
    array(
      '%value%',
      new Reference('bar'),
    ),
  ));
  $builder
    ->setParameter('value', 'bar');
  $this
    ->assertEquals(array(
    'bar',
    $builder
      ->get('bar'),
  ), $builder
    ->get('foo1')->bar, '->createService() replaces the values in the method calls arguments');
}