minor #19994 [DependencyInjection] Env parameterbag fix: use the correct exception class. (paradajozsef)

This PR was squashed before being merged into the 3.2-dev branch (closes #19994).

Discussion
----------

[DependencyInjection] Env parameterbag fix: use the correct exception class.

| Q             | A
| ------------- | ---
| Branch?       | "master"
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Small fix after #19681 No description needed imo. :)

Commits
-------

b016c60 [DependencyInjection] Env parameterbag fix: use the correct exception class.
This commit is contained in:
Fabien Potencier 2016-09-20 14:34:30 -07:00
commit 8f8f4344eb
2 changed files with 28 additions and 0 deletions

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\ParameterBag;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
/**
* @author Nicolas Grekas <p@tchwork.com>

View File

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Tests\ParameterBag;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
class EnvPlaceholderParameterBagTest extends \PHPUnit_Framework_TestCase
{
/**
* @expectedException InvalidArgumentException
*/
public function testGetThrowsInvalidArgumentExceptionIfEnvNameContainsNonWordCharacters()
{
$bag = new EnvPlaceholderParameterBag();
$bag->get('env(%foo%)');
}
}