You are here

public function RemoveUnusedDefinitionsPassTest::testProcessWontRemovePrivateFactory in Zircon Profile 8.0

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

File

vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php, line 83

Class

RemoveUnusedDefinitionsPassTest

Namespace

Symfony\Component\DependencyInjection\Tests\Compiler

Code

public function testProcessWontRemovePrivateFactory() {
  $container = new ContainerBuilder();
  $container
    ->register('foo', 'stdClass')
    ->setFactory(array(
    'stdClass',
    'getInstance',
  ))
    ->setPublic(false);
  $container
    ->register('bar', 'stdClass')
    ->setFactory(array(
    new Reference('foo'),
    'getInstance',
  ))
    ->setPublic(false);
  $container
    ->register('foobar')
    ->addArgument(new Reference('bar'));
  $this
    ->process($container);
  $this
    ->assertTrue($container
    ->hasDefinition('foo'));
  $this
    ->assertTrue($container
    ->hasDefinition('bar'));
  $this
    ->assertTrue($container
    ->hasDefinition('foobar'));
}