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

This commit is contained in:
Paráda József 2016-09-20 22:49:22 +02:00 committed by Fabien Potencier
parent 93c0e8adc2
commit b016c6029b
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%)');
}
}