You are here

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

@group legacy

File

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

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testLegacySetOnSynchronizedService() {
  $container = new ContainerBuilder();
  $container
    ->register('baz', 'BazClass')
    ->setSynchronized(true);
  $container
    ->register('bar', 'BarClass')
    ->addMethodCall('setBaz', array(
    new Reference('baz'),
  ));
  $container
    ->set('baz', $baz = new \BazClass());
  $this
    ->assertSame($baz, $container
    ->get('bar')
    ->getBaz());
  $container
    ->set('baz', $baz = new \BazClass());
  $this
    ->assertSame($baz, $container
    ->get('bar')
    ->getBaz());
}