@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.
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');
}