You are here

public function ContainerBuilderTest::testResolveServices in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testResolveServices()

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

File

vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php, line 439

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');
}