You are here

public function InlineServiceDefinitionsPassTest::testProcessInlinesIfMultipleReferencesButAllFromTheSameDefinition 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/InlineServiceDefinitionsPassTest.php \Symfony\Component\DependencyInjection\Tests\Compiler\InlineServiceDefinitionsPassTest::testProcessInlinesIfMultipleReferencesButAllFromTheSameDefinition()

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php, line 93

Class

InlineServiceDefinitionsPassTest

Namespace

Symfony\Component\DependencyInjection\Tests\Compiler

Code

public function testProcessInlinesIfMultipleReferencesButAllFromTheSameDefinition() {
  $container = new ContainerBuilder();
  $a = $container
    ->register('a')
    ->setPublic(false);
  $b = $container
    ->register('b')
    ->addArgument(new Reference('a'))
    ->addArgument(new Definition(null, array(
    new Reference('a'),
  )));
  $this
    ->process($container);
  $arguments = $b
    ->getArguments();
  $this
    ->assertSame($a, $arguments[0]);
  $inlinedArguments = $arguments[1]
    ->getArguments();
  $this
    ->assertSame($a, $inlinedArguments[0]);
}