public function AnalyzeServiceReferencesPassTest::testProcess

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php, line 23

Class

AnalyzeServiceReferencesPassTest

Namespace

Symfony\Component\DependencyInjection\Tests\Compiler

Code

public function testProcess() {
  $container = new ContainerBuilder();
  $a = $container
    ->register('a')
    ->addArgument($ref1 = new Reference('b'));
  $b = $container
    ->register('b')
    ->addMethodCall('setA', array(
    $ref2 = new Reference('a'),
  ));
  $c = $container
    ->register('c')
    ->addArgument($ref3 = new Reference('a'))
    ->addArgument($ref4 = new Reference('b'));
  $d = $container
    ->register('d')
    ->setProperty('foo', $ref5 = new Reference('b'));
  $e = $container
    ->register('e')
    ->setConfigurator(array(
    $ref6 = new Reference('b'),
    'methodName',
  ));
  $graph = $this
    ->process($container);
  $this
    ->assertCount(4, $edges = $graph
    ->getNode('b')
    ->getInEdges());
  $this
    ->assertSame($ref1, $edges[0]
    ->getValue());
  $this
    ->assertSame($ref4, $edges[1]
    ->getValue());
  $this
    ->assertSame($ref5, $edges[2]
    ->getValue());
  $this
    ->assertSame($ref6, $edges[3]
    ->getValue());
}