You are here

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

@group legacy

File

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

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testLegacySetOnSynchronizedService() {
  $this
    ->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
  $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());
}