mirror of
https://github.com/php/php-src.git
synced 2024-10-16 22:12:33 +00:00
95accd75bb
add tests
37 lines
678 B
PHP
37 lines
678 B
PHP
--TEST--
|
|
DOMDocumentFragment Tests
|
|
--SKIPIF--
|
|
<?php require_once('skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
require_once("dom_test.inc");
|
|
|
|
$dom = new DOMDocument;
|
|
$dom->loadXML(b'<root/>');
|
|
if(!$dom) {
|
|
echo "Error while parsing the document\n";
|
|
exit;
|
|
}
|
|
|
|
$node = $dom->documentElement;
|
|
|
|
try {
|
|
$frag1 = new DOMDocumentFragment();
|
|
$frag1->appendXML('<fragnode>1</fragnode>');
|
|
$node->appendXML($frag1);
|
|
} catch (DOMException $e) {
|
|
print "Read Only!\n\n";
|
|
}
|
|
|
|
$frag2 = $dom->createDocumentFragment();
|
|
$frag2->appendXML('<fragnode2>2</fragnode2>');
|
|
$node->appendChild($frag2);
|
|
|
|
print $dom->saveXML();
|
|
?>
|
|
--EXPECT--
|
|
Read Only!
|
|
|
|
<?xml version="1.0"?>
|
|
<root><fragnode2>2</fragnode2></root>
|