1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Add test for SimpleXMLElement::asXML() with a fragment and a filename

This commit is contained in:
Niels Dossche
2023-08-15 20:57:38 +02:00
parent 543eedf9e1
commit 2b61f71046

View File

@@ -0,0 +1,29 @@
--TEST--
SimpleXMLElement::asXML() with a fragment and a filename
--EXTENSIONS--
simplexml
--FILE--
<?php
$sxe = simplexml_load_string(<<<XML
<?xml version="1.0"?>
<container>
<container2>
<child id="foo">bar</child>
</container2>
</container>
XML);
$sxe->container2->asXML(__DIR__."/SimpleXMLElement_asXML_fragment_filename_output.tmp");
// Note: the strange indent is correct: the indent text node preceding container2 is not emitted.
echo file_get_contents(__DIR__."/SimpleXMLElement_asXML_fragment_filename_output.tmp");
?>
--CLEAN--
<?php
@unlink(__DIR__."/SimpleXMLElement_asXML_fragment_filename_output.tmp");
?>
--EXPECT--
<container2>
<child id="foo">bar</child>
</container2>