You are here

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

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

File

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

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testCreateProxyWithRealServiceInstantiator() {
  $builder = new ContainerBuilder();
  $builder
    ->register('foo1', 'Bar\\FooClass')
    ->setFile(__DIR__ . '/Fixtures/includes/foo.php');
  $builder
    ->getDefinition('foo1')
    ->setLazy(true);
  $foo1 = $builder
    ->get('foo1');
  $this
    ->assertSame($foo1, $builder
    ->get('foo1'), 'The same proxy is retrieved on multiple subsequent calls');
  $this
    ->assertSame('Bar\\FooClass', get_class($foo1));
}