You are here

public function ContainerBuilderTest::testCreateServiceWithExpression in Service Container 7.2

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

File

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

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testCreateServiceWithExpression() {
  $builder = new ContainerBuilder();
  $builder
    ->setParameter('bar', 'bar');
  $builder
    ->register('bar', 'BarClass');
  $builder
    ->register('foo', 'Bar\\FooClass')
    ->addArgument(array(
    'foo' => new Expression('service("bar").foo ~ parameter("bar")'),
  ));
  $this
    ->assertEquals('foobar', $builder
    ->get('foo')->arguments['foo']);
}