public function ContainerBuilderTest::testCreateServiceMethodCalls

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

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php, line 287

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testCreateServiceMethodCalls() {
  $builder = new ContainerBuilder();
  $builder
    ->register('bar', 'stdClass');
  $builder
    ->register('foo1', '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');
}