From f5bf45e6dab3576d7a3f45c1c72ac512e24a1e2e Mon Sep 17 00:00:00 2001 From: florianv Date: Thu, 26 Jun 2014 17:24:45 +0200 Subject: [PATCH] [Serializer] Added a test for decoding xml with whitespaces --- .../Tests/Encoder/XmlEncoderTest.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index 4f83c6f948a70..d3463d41bd781 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -312,6 +312,29 @@ public function testDecodeArray() $this->assertEquals($expected, $this->encoder->decode($source, 'xml')); } + public function testDecodeIgnoreWhiteSpace() + { + $source = << + + + Benjamin + Alexandre + + + Damien + Clay + + +XML; + $expected = array('person' => array( + array('firstname' => 'Benjamin', 'lastname' => 'Alexandre'), + array('firstname' => 'Damien', 'lastname' => 'Clay') + )); + + $this->assertEquals($expected, $this->encoder->decode($source, 'xml')); + } + public function testDecodeWithoutItemHash() { $obj = new ScalarDummy();