1--TEST--
2DOMChildNode::after(), before, replaceWith with DOMNode from wrong document throws exception
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7require_once("dom_test.inc");
8
9$dom1 = new DOMDocument;
10$dom1->loadXML('<test/>');
11
12$dom2 = new DOMDocument;
13$dom2->loadXML('<test><foo /></test>');
14
15$element = $dom1->documentElement;
16
17try {
18    $element->after($dom2->documentElement->firstChild);
19    echo "FAIL";
20} catch (DOMException $e) {
21    echo $e->getMessage() . "\n";
22}
23
24try {
25    $element->before($dom2->documentElement->firstChild);
26    echo "FAIL";
27} catch (DOMException $e) {
28    echo $e->getMessage() . "\n";
29}
30
31try {
32    $element->replaceWith($dom2->documentElement->firstChild);
33    echo "FAIL";
34} catch (DOMException $e) {
35    echo $e->getMessage();
36}
37?>
38--EXPECT--
39Wrong Document Error
40Wrong Document Error
41Wrong Document Error
42