You are here

public function IntegrationTest::testProcessRemovesAndInlinesRecursively in Zircon Profile 8

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

This tests that dependencies are correctly processed.

We're checking that:

  • A is public, B/C are private
  • A -> C
  • B -> C

File

vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php, line 32

Class

IntegrationTest
This class tests the integration of the different compiler passes.

Namespace

Symfony\Component\DependencyInjection\Tests\Compiler

Code

public function testProcessRemovesAndInlinesRecursively() {
  $container = new ContainerBuilder();
  $container
    ->setResourceTracking(false);
  $a = $container
    ->register('a', '\\stdClass')
    ->addArgument(new Reference('c'));
  $b = $container
    ->register('b', '\\stdClass')
    ->addArgument(new Reference('c'))
    ->setPublic(false);
  $c = $container
    ->register('c', '\\stdClass')
    ->setPublic(false);
  $container
    ->compile();
  $this
    ->assertTrue($container
    ->hasDefinition('a'));
  $arguments = $a
    ->getArguments();
  $this
    ->assertSame($c, $arguments[0]);
  $this
    ->assertFalse($container
    ->hasDefinition('b'));
  $this
    ->assertFalse($container
    ->hasDefinition('c'));
}