8000 [DependencyInjection] Add coverage for all invalid arguments in expor… · symfony/symfony@87c4f23 · GitHub
[go: up one dir, main page]

Skip to content

Commit 87c4f23

Browse files
committed
[DependencyInjection] Add coverage for all invalid arguments in exportParameters
1 parent 9d45acc commit 87c4f23

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
1717
use Symfony\Component\DependencyInjection\Reference;
1818
use Symfony\Component\DependencyInjection\Definition;
19+
use Symfony\Component\DependencyInjection\Variable;
1920

2021
class PhpDumperTest extends \PHPUnit_Framework_TestCase
2122
{
@@ -100,14 +101,24 @@ public function testDumpRelativeDir()
100101
}
101102

102103
/**
104+
* @dataProvider provideInvalidParameters
103105
* @expectedException \InvalidArgumentException
104106
*/
105-
public function testExportParameters()
107+
public function testExportParameters($parameters)
106108
{
107-
$dumper = new PhpDumper(new ContainerBuilder(new ParameterBag(array('foo' => new Reference('foo')))));
109+
$dumper = new PhpDumper(new ContainerBuilder(new ParameterBag($parameters)));
108110
$dumper->dump();
109111
}
110112

113+
public function provideInvalidParameters()
114+
{
115+
return array(
116+
array(array('foo' => new Definition('stdClass'))),
117+
array(array('foo' => new Reference('foo'))),
118+
array(array('foo' => new Variable('foo'))),
119+
);
120+
}
121+
111122
public function testAddParameters()
112123
{
113124
$container = include self::$fixturesPath.'/containers/container8.php';

0 commit comments

Comments
 (0)
0