@covers Symfony\Component\DependencyInjection\ContainerBuilder::compile
public function testCompilesClassDefinitionsOfLazyServices() {
if (!class_exists('Symfony\\Component\\Config\\Resource\\FileResource')) {
$this
->markTestSkipped('The "Config" component is not available');
}
$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);
}