You are here

public function ContainerBuilderTest::testCreateServiceArguments 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::testCreateServiceArguments()

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

File

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

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testCreateServiceArguments() {
  $builder = new ContainerBuilder();
  $builder
    ->register('bar', 'stdClass');
  $builder
    ->register('foo1', 'Bar\\FooClass')
    ->addArgument(array(
    'foo' => '%value%',
    '%value%' => 'foo',
    new Reference('bar'),
    '%%unescape_it%%',
  ));
  $builder
    ->setParameter('value', 'bar');
  $this
    ->assertEquals(array(
    'foo' => 'bar',
    'bar' => 'foo',
    $builder
      ->get('bar'),
    '%unescape_it%',
  ), $builder
    ->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition');
}