public function testGetThrowServiceNotFoundException() {
$sc = new ProjectServiceContainer();
$sc
->set('foo', $foo = new \stdClass());
$sc
->set('bar', $foo = new \stdClass());
$sc
->set('baz', $foo = new \stdClass());
try {
$sc
->get('foo1');
$this
->fail('->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException if the key does not exist');
} catch (\Exception $e) {
$this
->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException', $e, '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException if the key does not exist');
$this
->assertEquals('You have requested a non-existent service "foo1". Did you mean this: "foo"?', $e
->getMessage(), '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException with some advices');
}
try {
$sc
->get('bag');
$this
->fail('->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException if the key does not exist');
} catch (\Exception $e) {
$this
->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException', $e, '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException if the key does not exist');
$this
->assertEquals('You have requested a non-existent service "bag". Did you mean one of these: "bar", "baz"?', $e
->getMessage(), '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException with some advices');
}
}