You are here

public function AnalyzeServiceReferencesPassTest::testProcessDetectsFactoryReferences 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::testProcessDetectsFactoryReferences()

File

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

Class

AnalyzeServiceReferencesPassTest

Namespace

Symfony\Component\DependencyInjection\Tests\Compiler

Code

public function testProcessDetectsFactoryReferences() {
  $container = new ContainerBuilder();
  $container
    ->register('foo', 'stdClass')
    ->setFactory(array(
    'stdClass',
    'getInstance',
  ));
  $container
    ->register('bar', 'stdClass')
    ->setFactory(array(
    new Reference('foo'),
    'getInstance',
  ));
  $graph = $this
    ->process($container);
  $this
    ->assertTrue($graph
    ->hasNode('foo'));
  $this
    ->assertCount(1, $graph
    ->getNode('foo')
    ->getInEdges());
}