public function ContainerTest::testGetCircularReference in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerTest.php \Symfony\Component\DependencyInjection\Tests\ContainerTest::testGetCircularReference()
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ ContainerTest.php, line 262
Class
Namespace
Symfony\Component\DependencyInjection\TestsCode
public function testGetCircularReference() {
$sc = new ProjectServiceContainer();
try {
$sc
->get('circular');
$this
->fail('->get() throws a ServiceCircularReferenceException if it contains circular reference');
} catch (\Exception $e) {
$this
->assertInstanceOf('\\Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException', $e, '->get() throws a ServiceCircularReferenceException if it contains circular reference');
$this
->assertStringStartsWith('Circular reference detected for service "circular"', $e
->getMessage(), '->get() throws a \\LogicException if it contains circular reference');
}
}