You are here

public function AnalyzeServiceReferencesPassTest::testProcessDetectsReferencesFromInlinedFactoryDefinitions in Service Container 7

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

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php, line 81

Class

AnalyzeServiceReferencesPassTest

Namespace

Symfony\Component\DependencyInjection\Tests\Compiler

Code

public function testProcessDetectsReferencesFromInlinedFactoryDefinitions() {
  $container = new ContainerBuilder();
  $container
    ->register('a');
  $factory = new Definition();
  $factory
    ->setFactory(array(
    new Reference('a'),
    'a',
  ));
  $container
    ->register('b')
    ->addArgument($factory);
  $graph = $this
    ->process($container);
  $this
    ->assertTrue($graph
    ->hasNode('a'));
  $this
    ->assertCount(1, $refs = $graph
    ->getNode('a')
    ->getInEdges());
}