You are here

public function ContainerBuilderTest::testCreateProxyWithRealServiceInstantiator in Zircon Profile 8.0

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

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

File

vendor/symfony/dependency-injection/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));
}