File tree Expand file tree Collapse file tree 4 files changed +45
-2
lines changed
Tests/DependencyInjection
Tests/DependencyInjection Expand file tree Collapse file tree 4 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ private function addTemplatingSection(ArrayNodeDefinition $rootNode)
260
260
->addDefaultChildrenIfNoneSet ()
261
261
->prototype ('scalar ' )->defaultValue ('FrameworkBundle:Form ' )->end ()
262
262
->validate ()
263
- ->ifNotInArray ( array ( 'FrameworkBundle:Form ' ) )
263
+ ->ifTrue ( function ( $ v ) { return ! in_array ( 'FrameworkBundle:Form ' , $ v ); } )
264
264
->then (function ($ v ) {
265
265
return array_merge (array ('FrameworkBundle:Form ' ), $ v );
266
266
})
Original file line number Diff line number Diff line change @@ -27,6 +27,19 @@ public function testDefaultConfig()
27
27
);
28
28
}
29
29
30
+ public function testDoNoDuplicateDefaultFormResources ()
31
+ {
32
+ $ input = array ('templating ' => array (
33
+ 'form ' => array ('resources ' => array ('FrameworkBundle:Form ' )),
34
+ 'engines ' => array ('php ' ),
35
+ ));
36
+
37
+ $ processor = new Processor ();
38
+ $ config = $ processor ->processConfiguration (new Configuration (), array ($ input ));
39
+
40
+ $ this ->assertEquals (array ('FrameworkBundle:Form ' ), $ config ['templating ' ]['form ' ]['resources ' ]);
41
+ }
42
+
30
43
/**
31
44
* @dataProvider getTestValidTrustedProxiesData
32
45
*/
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ private function addFormSection(ArrayNodeDefinition $rootNode)
58
58
->prototype ('scalar ' )->defaultValue ('form_div_layout.html.twig ' )->end ()
59
59
->example (array ('MyBundle::form.html.twig ' ))
60
60
->validate ()
61
- ->ifNotInArray ( array ( 'form_div_layout.html.twig ' ) )
61
+ ->ifTrue ( function ( $ v ) { return ! in_array ( 'form_div_layout.html.twig ' , $ v ); } )
62
62
->then (function ($ v ) {
63
63
return array_merge (array ('form_div_layout.html.twig ' ), $ v );
64
64
})
Original file line number Diff line number Diff line change
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 \Bundle \TwigBundle \Tests \DependencyInjection ;
13
+
14
+ use Symfony \Bundle \TwigBundle \DependencyInjection \Configuration ;
15
+ use Symfony \Component \Config \Definition \Processor ;
16
+
17
+ class ConfigurationTest extends \PHPUnit_Framework_TestCase
18
+ {
19
+ public function testDoNoDuplicateDefaultFormResources ()
20
+ {
21
+ $ input = array (
22
+ 'form ' => array ('resources ' => array ('form_div_layout.html.twig ' )),
23
+ );
24
+
25
+ $ processor = new Processor ();
26
+ $ config = $ processor ->processConfiguration (new Configuration (), array ($ input ));
27
+
28
+ $ this ->assertEquals (array ('form_div_layout.html.twig ' ), $ config ['form ' ]['resources ' ]);
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments