function ReverseContainerTest::testGetId
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/DependencyInjection/ReverseContainerTest.php \Drupal\Tests\Component\DependencyInjection\ReverseContainerTest::testGetId()
- 11.x core/tests/Drupal/Tests/Component/DependencyInjection/ReverseContainerTest.php \Drupal\Tests\Component\DependencyInjection\ReverseContainerTest::testGetId()
@covers ::getId
File
-
core/
tests/ Drupal/ Tests/ Component/ DependencyInjection/ ReverseContainerTest.php, line 24
Class
- ReverseContainerTest
- @runTestsInSeparateProcesses The reverse container uses a static to maintain information across container rebuilds.
Namespace
Drupal\Tests\Component\DependencyInjectionCode
public function testGetId() : void {
$container = new ContainerBuilder();
$service = new \stdClass();
$container->set('bar', $service);
$reverse_container = new ReverseContainer($container);
$this->assertSame('bar', $reverse_container->getId($service));
$non_service = new \stdClass();
$this->assertNull($reverse_container->getId($non_service));
$this->assertSame('service_container', $reverse_container->getId($container));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.