function ContainerTest::testGetForClassFromParameter
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php \Drupal\Tests\Component\DependencyInjection\ContainerTest::testGetForClassFromParameter()
- 10 core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php \Drupal\Tests\Component\DependencyInjection\ContainerTest::testGetForClassFromParameter()
- 11.x core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php \Drupal\Tests\Component\DependencyInjection\ContainerTest::testGetForClassFromParameter()
Tests that Container::get() works properly for class from parameters.
@covers ::get @covers ::createService
File
-
core/
tests/ Drupal/ Tests/ Component/ DependencyInjection/ ContainerTest.php, line 193
Class
- ContainerTest
- @coversDefaultClass \Drupal\Component\DependencyInjection\Container @group DependencyInjection
Namespace
Drupal\Tests\Component\DependencyInjectionCode
public function testGetForClassFromParameter() {
$container_definition = $this->containerDefinition;
$container_definition['frozen'] = FALSE;
$container = new $this->containerClass($container_definition);
$other_service_class = $this->containerDefinition['parameters']['some_parameter_class'];
$other_service = $container->get('other.service_class_from_parameter');
$this->assertInstanceOf($other_service_class, $other_service);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.