1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt

32 lines
610 B
PHP

--TEST--
DOMParentNode::append() with DOMNode from wrong document throws exception
--EXTENSIONS--
dom
--FILE--
<?php
require_once("dom_test.inc");
function test($method) {
$dom1 = new DOMDocument;
$dom1->loadXML('<test/>');
$dom2 = new DOMDocument;
$dom2->loadXML('<test><foo /></test>');
$element = $dom1->documentElement;
try {
$element->$method($dom2->documentElement->firstChild);
echo "FAIL";
} catch (DOMException $e) {
echo $e->getMessage() . "\n";
}
}
test("append");
test("prepend");
?>
--EXPECT--
Wrong Document Error
Wrong Document Error