You are here

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

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

File

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

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testResolveServices() {
  $builder = new ContainerBuilder();
  $builder
    ->register('foo', 'Bar\\FooClass');
  $this
    ->assertEquals($builder
    ->get('foo'), $builder
    ->resolveServices(new Reference('foo')), '->resolveServices() resolves service references to service instances');
  $this
    ->assertEquals(array(
    'foo' => array(
      'foo',
      $builder
        ->get('foo'),
    ),
  ), $builder
    ->resolveServices(array(
    'foo' => array(
      'foo',
      new Reference('foo'),
    ),
  )), '->resolveServices() resolves service references to service instances in nested arrays');
  $this
    ->assertEquals($builder
    ->get('foo'), $builder
    ->resolveServices(new Expression('service("foo")')), '->resolveServices() resolves expressions');
}