8000 merged branch gnugat/dic-test-constants (PR #8663) · symfony/symfony@5cbfe30 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5cbfe30

Browse files
committed
merged branch gnugat/dic-test-constants (PR #8663)
This PR was squashed before being merged into the master branch (closes #8663). Discussion ---------- [DependencyInjection] Test constants | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | **yes** | License | MIT Added a test for constant support in XML configuration files. Related PR: #8661 Commits ------- 9acedb7 [DependencyInjection] Test constants
2 parents fa1d7f5 + 9acedb7 commit 5cbfe30

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
<parameter key="MixedCase" type="collection"> <!-- Should be lower cased -->
2828
<parameter key="MixedCaseKey">value</parameter> <!-- Should stay mixed case -->
2929
</parameter>
30+
<parameter key="constant" type="constant">PHP_EOL</parameter>
3031
</parameters>
3132
</container>

src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,27 @@ public function testLoadParameters()
9999
$loader->load('services2.xml');
100100

101101
$actual = $container->getParameterBag()->all();
102-
$expected = array('a string', 'foo' => 'bar', 'values' => array(0, 'integer' => 4, 100 => null, 'true', true, false, 'on', 'off', 'float' => 1.3, 1000.3, 'a string', array('foo', 'bar')), 'foo_bar' => new Reference('foo_bar'), 'mixedcase' => array('MixedCaseKey' => 'value'));
102+
$expected = array(
103+
'a string',
104+
'foo' => 'bar',
105+
'values' => array(
106+
0,
107+
'integer' => 4,
108+
100 => null,
109+
'true',
110+
true,
111+
false,
112+
'on',
113+
'off',
114+
'float' => 1.3,
115+
1000.3,
116+
'a string',
117+
array('foo', 'bar'),
118+
),
119+
'foo_bar' => new Reference('foo_bar'),
120+
'mixedcase' => array('MixedCaseKey' => 'value'),
121+
'constant' => PHP_EOL,
122+
);
103123

104124
$this->assertEquals($expected, $actual, '->load() converts XML values to PHP ones');
105125
}
@@ -120,7 +140,30 @@ public function testLoadImports()
120140
$loader->load('services4.xml');
121141

122142
$actual = $container->getParameterBag()->all();
123-
$expected = array('a string', 'foo' => 'bar', 'values' => array(true, false), 'foo_bar' => new Reference('foo_bar'), 'mixedcase' => array('MixedCaseKey' => 'value'), 'bar' => '%foo%', 'imported_from_ini' => true, 'imported_from_yaml' => true);
143+
$expected = array(
144+
'a string',
145+
'foo' => 'bar',
146+
'values' => array(
147+
0,
148+
'integer' => 4,
149+
100 => null,
150+
'true',
151+
true,
152+
false,
153+
'on',
154+
'off',
155+
'float' => 1.3,
156+
1000.3,
157+
'a string',
158+
array('foo', 'bar'),
159+
),
160+
'foo_bar' => new Reference('foo_bar'),
161+
'mixedcase' => array('MixedCaseKey' => 'value'),
162+
'constant' => PHP_EOL,
163+
'bar' => '%foo%',
164+
'imported_from_ini' => true,
165+
'imported_from_yaml' => true
166+
);
124167

125168
$this->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files');
126169

0 commit comments

Comments
 (0)
0