You are here

public function ContainerBuilderTest::testCompilesClassDefinitionsOfLazyServices in Zircon Profile 8

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

@covers Symfony\Component\DependencyInjection\ContainerBuilder::compile

File

vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php, line 595

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testCompilesClassDefinitionsOfLazyServices() {
  $container = new ContainerBuilder();
  $this
    ->assertEmpty($container
    ->getResources(), 'No resources get registered without resource tracking');
  $container
    ->register('foo', 'BarClass');
  $container
    ->getDefinition('foo')
    ->setLazy(true);
  $container
    ->compile();
  $classesPath = realpath(__DIR__ . '/Fixtures/includes/classes.php');
  $matchingResources = array_filter($container
    ->getResources(), function (ResourceInterface $resource) use ($classesPath) {
    return $resource instanceof FileResource && $classesPath === realpath($resource
      ->getResource());
  });
  $this
    ->assertNotEmpty($matchingResources);
}