Skip to content

Navigation Menu

Sign in
Appearance settings

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 8b54211

Browse filesBrowse files
committed
minor #11233 [Serializer] Added a test for decoding xml with whitespaces (florianv)
This PR was merged into the 2.6-dev branch. Discussion ---------- [Serializer] Added a test for decoding xml with whitespaces | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | The PR 466a3d7 introduced a BC break because white spaces were previously decoded as text nodes. So this PR reverts it and adds a context option to configure it. Commits ------- f5bf45e [Serializer] Added a test for decoding xml with whitespaces
2 parents ab3fb14 + f5bf45e commit 8b54211
Copy full SHA for 8b54211

File tree

Expand file treeCollapse file tree

1 file changed

+23
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+23
-0
lines changed

‎src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,29 @@ public function testDecodeArray()
312312
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
313313
}
314314

315+
public function testDecodeIgnoreWhiteSpace()
316+
{
317+
$source = <<<XML
318+
<?xml version="1.0"?>
319+
<people>
320+
<person>
321+
<firstname>Benjamin</firstname>
322+
<lastname>Alexandre</lastname>
323+
</person>
324+
<person>
325+
<firstname>Damien</firstname>
326+
<lastname>Clay</lastname>
327+
</person>
328+
</people>
329+
XML;
330+
$expected = array('person' => array(
331+
array('firstname' => 'Benjamin', 'lastname' => 'Alexandre'),
332+
array('firstname' => 'Damien', 'lastname' => 'Clay')
333+
));
334+
335+
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
336+
}
337+
315338
public function testDecodeWithoutItemHash()
316339
{
317340
$obj = new ScalarDummy();

0 commit comments

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