You are here

public function AnalyzeServiceReferencesPassTest::testProcess in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php \Symfony\Component\DependencyInjection\Tests\Compiler\AnalyzeServiceReferencesPassTest::testProcess()

File

vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php, line 22

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());
}