public function ParameterBagTest::testGetThrowParameterNotFoundException in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php \Symfony\Component\DependencyInjection\Tests\ParameterBag\ParameterBagTest::testGetThrowParameterNotFoundException()
File
- vendor/
symfony/ dependency-injection/ Tests/ ParameterBag/ ParameterBagTest.php, line 87
Class
Namespace
Symfony\Component\DependencyInjection\Tests\ParameterBagCode
public function testGetThrowParameterNotFoundException() {
$bag = new ParameterBag(array(
'foo' => 'foo',
'bar' => 'bar',
'baz' => 'baz',
));
try {
$bag
->get('foo1');
$this
->fail('->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException if the key does not exist');
} catch (\Exception $e) {
$this
->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException', $e, '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException if the key does not exist');
$this
->assertEquals('You have requested a non-existent parameter "foo1". Did you mean this: "foo"?', $e
->getMessage(), '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException with some advices');
}
try {
$bag
->get('bag');
$this
->fail('->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException if the key does not exist');
} catch (\Exception $e) {
$this
->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException', $e, '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException if the key does not exist');
$this
->assertEquals('You have requested a non-existent parameter "bag". Did you mean one of these: "bar", "baz"?', $e
->getMessage(), '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException with some advices');
}
try {
$bag
->get('');
$this
->fail('->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException if the key does not exist');
} catch (\Exception $e) {
$this
->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException', $e, '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException if the key does not exist');
$this
->assertEquals('You have requested a non-existent parameter "".', $e
->getMessage(), '->get() throws an Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException with some advices');
}
}