function ProxyServicesPassTest::testContainerWithLazyServices
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\ProxyServicesPassTest::testContainerWithLazyServices()
- 10 core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\ProxyServicesPassTest::testContainerWithLazyServices()
- 9 core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\ProxyServicesPassTest::testContainerWithLazyServices()
- 8.9.x core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\ProxyServicesPassTest::testContainerWithLazyServices()
Tests container with lazy services.
@legacy-covers ::process
File
-
core/
tests/ Drupal/ Tests/ Core/ DependencyInjection/ Compiler/ ProxyServicesPassTest.php, line 60
Class
Namespace
Drupal\Tests\Core\DependencyInjection\CompilerCode
public function testContainerWithLazyServices() : void {
$container = new ContainerBuilder();
$container->register('test_lazy_service', LazyService::class)
->setLazy(TRUE);
$this->proxyServicesPass
->process($container);
$this->assertCount(3, $container->getDefinitions());
$non_proxy_definition = $container->getDefinition('drupal.proxy_original_service.test_lazy_service');
$this->assertEquals(LazyService::class, $non_proxy_definition->getClass());
$this->assertFalse($non_proxy_definition->isLazy());
$this->assertTrue($non_proxy_definition->isPublic());
$this->assertEquals(LazyServiceProxy::class, $container->getDefinition('test_lazy_service')
->getClass());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.