public function ContainerBuilderTest::testGetUnsetLoadingServiceWhenCreateServiceThrowsAnException in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testGetUnsetLoadingServiceWhenCreateServiceThrowsAnException()
@covers \Symfony\Component\DependencyInjection\ContainerBuilder::get @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException @expectedExceptionMessage You have requested a synthetic service ("foo"). The DIC does not know how to construct this service.
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ ContainerBuilderTest.php, line 129
Class
Namespace
Symfony\Component\DependencyInjection\TestsCode
public function testGetUnsetLoadingServiceWhenCreateServiceThrowsAnException() {
$builder = new ContainerBuilder();
$builder
->register('foo', 'stdClass')
->setSynthetic(true);
// we expect a RuntimeException here as foo is synthetic
try {
$builder
->get('foo');
} catch (RuntimeException $e) {
}
// we must also have the same RuntimeException here
$builder
->get('foo');
}