8000 Add tests for DOMNode case · symfony/symfony@fed5e4a · GitHub
[go: up one dir, main page]

Skip to content

Commit fed5e4a

Browse files
committed
Add tests for DOMNode case
1 parent 141d9ee commit fed5e4a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,20 @@ public function testEncodeXmlWithBoolValue()
662662
$this->assertEquals($expectedXml, $actualXml);
663663
}
664664

665+
public function testEncodeXmlWithDomNodeValue()
666+
{
667+
$expectedXml = <<<'XML'
668+
<?xml version="1.0"?>
669+
<response><foo>bar</foo><bar>foo &amp; bar</bar></response>
670+
671+
XML;
672+
$document = new \DOMDocument();
673+
674+
$actualXml = $this->encoder->encode(['foo' => $document->createTextNode('bar'), 'bar' => $document->createTextNode('foo & bar')], 'xml');
675+
676+
$this->assertEquals($expectedXml, $actualXml);
677+
}
678+
665679
public function testEncodeXmlWithDateTimeObjectValue()
666680
{
667681
$xmlEncoder = $this->createXmlEncoderWithDateTimeNormalizer();

0 commit comments

Comments
 (0)
0