Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8c16727

Browse filesBrowse files
committed
Don’t normalize global values
1 parent 8c4fd12 commit 8c16727
Copy full SHA for 8c16727

File tree

2 files changed

+25
-0
lines changed
Filter options

2 files changed

+25
-0
lines changed

‎src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ private function addGlobalsSection(ArrayNodeDefinition $rootNode)
7676
->useAttributeAsKey('key')
7777
->example(array('foo' => '"@bar"', 'pi' => 3.14))
7878
->prototype('array')
79+
->normalizeKeys(false)
7980
->beforeNormalization()
8081
->ifTrue(function ($v) { return is_string($v) && 0 === strpos($v, '@'); })
8182
->then(function ($v) {

‎src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,28 @@ public function testGetStrictVariablesDefaultFalse()
4141

4242
$this->assertFalse($config['strict_variables']);
4343
}
44+
45+
public function testGlobalsAreNotNormalized()
46+
{
47+
$input = array(
48+
'globals' => array('some-global' => true),
49+
);
50+
51+
$processor = new Processor();
52+
$config = $processor->processConfiguration(new Configuration(), array($input));
53+
54+
$this->assertSame(array('some-global' => array('value' => true)), $config['globals']);
55+
}
56+
57+
public function testArrayKeysInGlobalsAreNotNormalized()
58+
{
59+
$input = array(
60+
'globals' => array('global' => array('some-key' => 'some-value')),
61+
);
62+
63+
$processor = new Processor();
64+
$config = $processor->processConfiguration(new Configuration(), array($input));
65+
66+
$this->assertSame(array('global' => array('value' => array('some-key' => 'some-value'))), $config['globals']);
67+
}
4468
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.