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
9function test($method) {
10    $dom1 = new DOMDocument;
11    $dom1->loadXML('<test/>');
12
13    $dom2 = new DOMDocument;
14    $dom2->loadXML('<test><foo /></test>');
15
16    $element = $dom1->documentElement;
17
18    try {
19        $element->$method($dom2->documentElement->firstChild);
20        echo "FAIL";
21    } catch (DOMException $e) {
22        echo $e->getMessage() . "\n";
23    }
24}
25
26test("after");
27test("before");
28test("replaceWith");
29
30?>
31--EXPECT--
32Wrong Document Error
33Wrong Document Error
34Wrong Document Error
35