File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 16
16
use Symfony \Component \DependencyInjection \ParameterBag \ParameterBag ;
17
17
use Symfony \Component \DependencyInjection \Reference ;
18
18
use Symfony \Component \DependencyInjection \Definition ;
19
+ use Symfony \Component \DependencyInjection \Variable ;
20
+ use Symfony \Component \ExpressionLanguage \Expression ;
19
21
20
22
class PhpDumperTest extends \PHPUnit_Framework_TestCase
21
23
{
@@ -85,14 +87,25 @@ public function testDumpRelativeDir()
85
87
}
86
88
87
89
/**
90
+ * @dataProvider provideInvalidParameters
88
91
* @expectedException \InvalidArgumentException
89
92
*/
90
- public function testExportParameters ()
93
+ public function testExportParameters ($ parameters )
91
94
{
92
- $ dumper = new PhpDumper (new ContainerBuilder (new ParameterBag (array ( ' foo ' => new Reference ( ' foo ' )) )));
95
+ $ dumper = new PhpDumper (new ContainerBuilder (new ParameterBag ($ parameters )));
93
96
$ dumper ->dump ();
94
97
}
95
98
99
+ public function provideInvalidParameters ()
100
+ {
101
+ return array (
102
+ array (array ('foo ' => new Definition ('stdClass ' ))),
103
+ array (array ('foo ' => new Expression ('service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default") ' ))),
104
+ array (array ('foo ' => new Reference ('foo ' ))),
105
+ array (array ('foo ' => new Variable ('foo ' ))),
106
+ );
107
+ }
108
+
96
109
public function testAddParameters ()
97
110
{
98
111
$ container = include self ::$ fixturesPath .'/containers/container8.php ' ;
You can’t perform that action at this time.
0 commit comments