Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f8f434

Browse files
committed
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.
2 parents 93c0e8a + b016c60 commit 8f8f434

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 <[email protected]>
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 <[email protected]>
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)