Don’t normalize global values
This commit is contained in:
parent
8c4fd1299b
commit
8c1672743d
@ -76,6 +76,7 @@ class Configuration implements ConfigurationInterface
|
||||
->useAttributeAsKey('key')
|
||||
->example(array('foo' => '"@bar"', 'pi' => 3.14))
|
||||
->prototype('array')
|
||||
->normalizeKeys(false)
|
||||
->beforeNormalization()
|
||||
->ifTrue(function ($v) { return is_string($v) && 0 === strpos($v, '@'); })
|
||||
->then(function ($v) {
|
||||
|
@ -41,4 +41,28 @@ class ConfigurationTest extends TestCase
|
||||
|
||||
$this->assertFalse($config['strict_variables']);
|
||||
}
|
||||
|
||||
public function testGlobalsAreNotNormalized()
|
||||
{
|
||||
$input = array(
|
||||
'globals' => array('some-global' => true),
|
||||
);
|
||||
|
||||
$processor = new Processor();
|
||||
$config = $processor->processConfiguration(new Configuration(), array($input));
|
||||
|
||||
$this->assertSame(array('some-global' => array('value' => true)), $config['globals']);
|
||||
}
|
||||
|
||||
public function testArrayKeysInGlobalsAreNotNormalized()
|
||||
{
|
||||
$input = array(
|
||||
'globals' => array('global' => array('some-key' => 'some-value')),
|
||||
);
|
||||
|
||||
$processor = new Processor();
|
||||
$config = $processor->processConfiguration(new Configuration(), array($input));
|
||||
|
||||
$this->assertSame(array('global' => array('value' => array('some-key' => 'some-value'))), $config['globals']);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user