You are here

public function IntegrationTest::testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDefinition in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php \Symfony\Component\DependencyInjection\Tests\Compiler\IntegrationTest::testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDefinition()

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php, line 88

Class

IntegrationTest
This class tests the integration of the different compiler passes.

Namespace

Symfony\Component\DependencyInjection\Tests\Compiler

Code

public function testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDefinition() {
  $container = new ContainerBuilder();
  $container
    ->setResourceTracking(false);
  $container
    ->register('a', '\\stdClass')
    ->addArgument(new Reference('b'))
    ->addMethodCall('setC', array(
    new Reference('c'),
  ));
  $container
    ->register('b', '\\stdClass')
    ->addArgument(new Reference('c'))
    ->setPublic(false);
  $container
    ->register('c', '\\stdClass')
    ->setPublic(false);
  $container
    ->compile();
  $this
    ->assertTrue($container
    ->hasDefinition('a'));
  $this
    ->assertFalse($container
    ->hasDefinition('b'));
  $this
    ->assertFalse($container
    ->hasDefinition('c'), 'Service C was not inlined.');
}