Skip to content

Commit 2b61f71

Browse files
committed
Add test for SimpleXMLElement::asXML() with a fragment and a filename
1 parent 543eedf commit 2b61f71

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
SimpleXMLElement::asXML() with a fragment and a filename
3+
--EXTENSIONS--
4+
simplexml
5+
--FILE--
6+
<?php
7+
8+
$sxe = simplexml_load_string(<<<XML
9+
<?xml version="1.0"?>
10+
<container>
11+
<container2>
12+
<child id="foo">bar</child>
13+
</container2>
14+
</container>
15+
XML);
16+
$sxe->container2->asXML(__DIR__."/SimpleXMLElement_asXML_fragment_filename_output.tmp");
17+
18+
// Note: the strange indent is correct: the indent text node preceding container2 is not emitted.
19+
echo file_get_contents(__DIR__."/SimpleXMLElement_asXML_fragment_filename_output.tmp");
20+
21+
?>
22+
--CLEAN--
23+
<?php
24+
@unlink(__DIR__."/SimpleXMLElement_asXML_fragment_filename_output.tmp");
25+
?>
26+
--EXPECT--
27+
<container2>
28+
<child id="foo">bar</child>
29+
</container2>

0 commit comments

Comments
 (0)