1--TEST--
2Tests DOMNode::insertBefore()
3--CREDITS--
4Michael Stillwell <mjs@beebo.org>
5# TestFest 2008
6--SKIPIF--
7<?php require_once('skipif.inc'); ?>
8--FILE--
9<?php
10
11$dom = new DOMDocument();
12$dom->loadXML('<root/>');
13echo $dom->saveXML();
14
15$e1 = $dom->createElement("A");
16$e2 = $dom->documentElement->appendChild($dom->createElement("B"));
17
18echo "Add new node B\n";
19echo $dom->saveXML();
20
21echo "Add new node A before B\n";
22$e2->parentNode->insertBefore($e1, $e2);
23echo $dom->saveXML();
24
25?>
26--EXPECT--
27<?xml version="1.0"?>
28<root/>
29Add new node B
30<?xml version="1.0"?>
31<root><B/></root>
32Add new node A before B
33<?xml version="1.0"?>
34<root><A/><B/></root>
35