8000 [DependencyInjection] Env parameterbag fix: use the correct exception… · symfony/symfony@b016c60 · GitHub
[go: up one dir, main page]

Skip to content

Commit b016c60

Browse files
paradajozseffabpot
authored andcommitted
[DependencyInjection] Env parameterbag fix: use the correct exception class.
1 parent 93c0e8a commit b016c60

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\ParameterBag;
1313

1414
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
15+
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1516

1617
/**
1718
* @author Nicolas Grekas <p@tchwork.com>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Tests\ParameterBag;
13+
14+
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
15+
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
16+
17+
class EnvPlaceholderParameterBagTest extends \PHPUnit_Framework_TestCase
18+
{
19+
/**
20+
* @expectedException InvalidArgumentException
21+
*/
22+
public function testGetThrowsInvalidArgumentExceptionIfEnvNameContainsNonWordCharacters()
23+
{
24+
$bag = new EnvPlaceholderParameterBag();
25+
$bag->get('env(%foo%)');
26+
}
27+
}

0 commit comments

Comments
 (0)
0