summaryrefslogtreecommitdiff
path: root/ext/dom/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom/tests')
-rw-r--r--ext/dom/tests/DOM4_ChildNode_wrong_document.phpt41
-rw-r--r--ext/dom/tests/DOM4_DOMNode_ElementSiblings.phpt25
-rw-r--r--ext/dom/tests/DOM4_DOMNode_after.phpt35
-rw-r--r--ext/dom/tests/DOM4_DOMNode_after_ns.phpt29
-rw-r--r--ext/dom/tests/DOM4_DOMNode_append_ns.phpt25
-rw-r--r--ext/dom/tests/DOM4_DOMNode_before.phpt35
-rw-r--r--ext/dom/tests/DOM4_DOMNode_before_ns.phpt29
-rw-r--r--ext/dom/tests/DOM4_DOMNode_prepend_ns.phpt25
-rw-r--r--ext/dom/tests/DOM4_DOMNode_remove.phpt30
-rw-r--r--ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt18
-rw-r--r--ext/dom/tests/DOM4_DOMNode_replaceWith.phpt27
-rw-r--r--ext/dom/tests/DOM4_ParentNode.phpt51
-rw-r--r--ext/dom/tests/DOM4_ParentNode_Fragment.phpt41
-rw-r--r--ext/dom/tests/DOM4_ParentNode_append.phpt41
-rw-r--r--ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt18
-rw-r--r--ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt26
-rw-r--r--ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt33
-rw-r--r--ext/dom/tests/DOM4_ParentNode_prepend.phpt49
-rw-r--r--ext/dom/tests/bug69846.phpt24
-rw-r--r--ext/dom/tests/dom_test.inc18
-rw-r--r--ext/dom/tests/domobject_debug_handler.phpt3
21 files changed, 620 insertions, 3 deletions
diff --git a/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt b/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt
new file mode 100644
index 0000000000..dc16cc158f
--- /dev/null
+++ b/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt
@@ -0,0 +1,41 @@
+--TEST--
+DOMChildNode::after(), before, replaceWith with DOMNode from wrong document throws exception
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom1 = new DOMDocument;
+$dom1->loadXML('<test/>');
+
+$dom2 = new DOMDocument;
+$dom2->loadXML('<test><foo /></test>');
+
+$element = $dom1->documentElement;
+
+try {
+ $element->after($dom2->documentElement->firstChild);
+ echo "FAIL";
+} catch (DOMException $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $element->before($dom2->documentElement->firstChild);
+ echo "FAIL";
+} catch (DOMException $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $element->replaceWith($dom2->documentElement->firstChild);
+ echo "FAIL";
+} catch (DOMException $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
+Wrong Document Error
+Wrong Document Error
+Wrong Document Error
diff --git a/ext/dom/tests/DOM4_DOMNode_ElementSiblings.phpt b/ext/dom/tests/DOM4_DOMNode_ElementSiblings.phpt
new file mode 100644
index 0000000000..8a27837cf6
--- /dev/null
+++ b/ext/dom/tests/DOM4_DOMNode_ElementSiblings.phpt
@@ -0,0 +1,25 @@
+--TEST--
+DOMNode: Element Siblings
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML('<test>foo<bar>FirstElement</bar><bar>LastElement</bar>bar</test>');
+
+$element = $dom->documentElement;
+print_node($element->firstElementChild->nextElementSibling);
+print_node($element->lastElementChild->previousElementSibling);
+?>
+--EXPECT--
+Node Name: bar
+Node Type: 1
+Num Children: 1
+Node Content: LastElement
+
+Node Name: bar
+Node Type: 1
+Num Children: 1
+Node Content: FirstElement
diff --git a/ext/dom/tests/DOM4_DOMNode_after.phpt b/ext/dom/tests/DOM4_DOMNode_after.phpt
new file mode 100644
index 0000000000..c53fdba972
--- /dev/null
+++ b/ext/dom/tests/DOM4_DOMNode_after.phpt
@@ -0,0 +1,35 @@
+--TEST--
+DOMNode::after()
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML('<test><mark>first</mark><mark>second</mark></test>');
+
+$element = $dom->documentElement->firstElementChild;
+$secondMark = $dom->documentElement->lastElementChild;
+
+$element->after(
+ 'text inserted after',
+ $dom->createElement('inserted-after', 'content')
+);
+
+$secondMark->after('text inserted after second');
+
+print_node_list_compact($dom->documentElement->childNodes);
+?>
+--EXPECT--
+<mark>
+ first
+</mark>
+text inserted after
+<inserted-after>
+ content
+</inserted-after>
+<mark>
+ second
+</mark>
+text inserted after second
diff --git a/ext/dom/tests/DOM4_DOMNode_after_ns.phpt b/ext/dom/tests/DOM4_DOMNode_after_ns.phpt
new file mode 100644
index 0000000000..0b28846a56
--- /dev/null
+++ b/ext/dom/tests/DOM4_DOMNode_after_ns.phpt
@@ -0,0 +1,29 @@
+--TEST--
+DOMNode::after() with namespace
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$doc = new DOMDocument('1.0', 'utf-8');
+$doc->formatOutput = true;
+
+$root = $doc->createElementNS('http://www.w3.org/2005/Atom', 'element');
+$doc->appendChild($root);
+$root->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:g', 'http://base.google.com/ns/1.0');
+
+$item = $doc->createElementNS('http://base.google.com/ns/1.0', 'g:item_type', 'house');
+$root->append($item);
+
+$item2 = $doc->createElementNS('http://base.google.com/ns/1.0', 'g:item_type', 'street');
+$item->after($item2);
+
+echo $doc->saveXML(), "\n";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="utf-8"?>
+<element xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
+ <g:item_type>house</g:item_type>
+ <g:item_type>street</g:item_type>
+</element>
diff --git a/ext/dom/tests/DOM4_DOMNode_append_ns.phpt b/ext/dom/tests/DOM4_DOMNode_append_ns.phpt
new file mode 100644
index 0000000000..936addb1fa
--- /dev/null
+++ b/ext/dom/tests/DOM4_DOMNode_append_ns.phpt
@@ -0,0 +1,25 @@
+--TEST--
+DOMNode::append() with namespace
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$doc = new DOMDocument('1.0', 'utf-8');
+$doc->formatOutput = true;
+
+$root = $doc->createElementNS('http://www.w3.org/2005/Atom', 'element');
+$doc->appendChild($root);
+$root->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:g', 'http://base.google.com/ns/1.0');
+
+$item = $doc->createElementNS('http://base.google.com/ns/1.0', 'g:item_type', 'house');
+$root->append($item);
+
+echo $doc->saveXML(), "\n";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="utf-8"?>
+<element xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
+ <g:item_type>house</g:item_type>
+</element>
diff --git a/ext/dom/tests/DOM4_DOMNode_before.phpt b/ext/dom/tests/DOM4_DOMNode_before.phpt
new file mode 100644
index 0000000000..b3806aff2e
--- /dev/null
+++ b/ext/dom/tests/DOM4_DOMNode_before.phpt
@@ -0,0 +1,35 @@
+--TEST--
+DOMNode::before()
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML('<test><mark>first</mark><mark>second</mark></test>');
+
+$element = $dom->documentElement->firstElementChild;
+$secondMark = $dom->documentElement->lastElementChild;
+
+$element->before(
+ $dom->createElement('inserted-before', 'content'),
+ 'text inserted before'
+);
+
+$secondMark->before('text inserted before second');
+
+print_node_list_compact($dom->documentElement->childNodes);
+?>
+--EXPECT--
+<inserted-before>
+ content
+</inserted-before>
+text inserted before
+<mark>
+ first
+</mark>
+text inserted before second
+<mark>
+ second
+</mark>
diff --git a/ext/dom/tests/DOM4_DOMNode_before_ns.phpt b/ext/dom/tests/DOM4_DOMNode_before_ns.phpt
new file mode 100644
index 0000000000..6ff2ca7729
--- /dev/null
+++ b/ext/dom/tests/DOM4_DOMNode_before_ns.phpt
@@ -0,0 +1,29 @@
+--TEST--
+DOMNode::before() with namespace
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$doc = new DOMDocument('1.0', 'utf-8');
+$doc->formatOutput = true;
+
+$root = $doc->createElementNS('http://www.w3.org/2005/Atom', 'element');
+$doc->appendChild($root);
+$root->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:g', 'http://base.google.com/ns/1.0');
+
+$item = $doc->createElementNS('http://base.google.com/ns/1.0', 'g:item_type', 'house');
+$root->append($item);
+
+$item2 = $doc->createElementNS('http://base.google.com/ns/1.0', 'g:item_type', 'street');
+$item->before($item2);
+
+echo $doc->saveXML(), "\n";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="utf-8"?>
+<element xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
+ <g:item_type>street</g:item_type>
+ <g:item_type>house</g:item_type>
+</element>
diff --git a/ext/dom/tests/DOM4_DOMNode_prepend_ns.phpt b/ext/dom/tests/DOM4_DOMNode_prepend_ns.phpt
new file mode 100644
index 0000000000..c31cb6fa77
--- /dev/null
+++ b/ext/dom/tests/DOM4_DOMNode_prepend_ns.phpt
@@ -0,0 +1,25 @@
+--TEST--
+DOMNode::prepend() with namespace
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$doc = new DOMDocument('1.0', 'utf-8');
+$doc->formatOutput = true;
+
+$root = $doc->createElementNS('http://www.w3.org/2005/Atom', 'element');
+$doc->appendChild($root);
+$root->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:g', 'http://base.google.com/ns/1.0');
+
+$item = $doc->createElementNS('http://base.google.com/ns/1.0', 'g:item_type', 'house');
+$root->prepend($item);
+
+echo $doc->saveXML(), "\n";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="utf-8"?>
+<element xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
+ <g:item_type>house</g:item_type>
+</element>
diff --git a/ext/dom/tests/DOM4_DOMNode_remove.phpt b/ext/dom/tests/DOM4_DOMNode_remove.phpt
new file mode 100644
index 0000000000..8eb1609531
--- /dev/null
+++ b/ext/dom/tests/DOM4_DOMNode_remove.phpt
@@ -0,0 +1,30 @@
+--TEST--
+DOMNode::remove()
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML('<test><one>first</one><two>second</two></test>');
+
+$element = $dom->documentElement;
+print_node($element->firstChild);
+$returnValue = $element->firstChild->remove();
+print_node($element->firstChild);
+var_dump($returnValue);
+?>
+--EXPECT--
+Node Name: one
+Node Type: 1
+Num Children: 1
+Node Content: first
+
+Node Name: two
+Node Type: 1
+Num Children: 1
+Node Content: second
+
+NULL
+
diff --git a/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt b/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt
new file mode 100644
index 0000000000..ceedac4084
--- /dev/null
+++ b/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt
@@ -0,0 +1,18 @@
+--TEST--
+DOMNode::remove() dangling element
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$dom = new DOMDocument();
+
+$element = $dom->createElement('test');
+
+try {
+ $element->remove();
+} catch (DOMException $e) {
+ echo $e->getMessage();
+}
+--EXPECT--
+Not Found Error
diff --git a/ext/dom/tests/DOM4_DOMNode_replaceWith.phpt b/ext/dom/tests/DOM4_DOMNode_replaceWith.phpt
new file mode 100644
index 0000000000..ceaf72678a
--- /dev/null
+++ b/ext/dom/tests/DOM4_DOMNode_replaceWith.phpt
@@ -0,0 +1,27 @@
+--TEST--
+DOMNode::replaceWith()
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML('<test><mark>first</mark><mark>second</mark></test>');
+
+$element = $dom->documentElement->firstChild;
+$element->replaceWith(
+ $dom->createElement('element', 'content'),
+ 'content'
+);
+
+print_node_list_compact($dom->documentElement->childNodes);
+?>
+--EXPECT--
+<element>
+ content
+</element>
+content
+<mark>
+ second
+</mark>
diff --git a/ext/dom/tests/DOM4_ParentNode.phpt b/ext/dom/tests/DOM4_ParentNode.phpt
new file mode 100644
index 0000000000..f5bc5dab90
--- /dev/null
+++ b/ext/dom/tests/DOM4_ParentNode.phpt
@@ -0,0 +1,51 @@
+--TEST--
+DOMParentNode: Child Element Handling
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML('<test>foo<bar>FirstElement</bar><bar>LastElement</bar>bar</test>');
+
+var_dump($dom instanceof DOMParentNode);
+print_node($dom->firstElementChild);
+print_node($dom->lastElementChild);
+var_dump($dom->childElementCount);
+
+$element = $dom->documentElement;
+var_dump($element instanceof DOMParentNode);
+print_node($element->firstElementChild);
+print_node($element->lastElementChild);
+var_dump($element->childElementCount);
+var_dump($element->lastElementChild->firstElementChild);
+var_dump($element->lastElementChild->lastElementChild);
+var_dump($element->lastElementChild->childElementCount);
+?>
+--EXPECT--
+bool(true)
+Node Name: test
+Node Type: 1
+Num Children: 4
+
+Node Name: test
+Node Type: 1
+Num Children: 4
+
+int(1)
+bool(true)
+Node Name: bar
+Node Type: 1
+Num Children: 1
+Node Content: FirstElement
+
+Node Name: bar
+Node Type: 1
+Num Children: 1
+Node Content: LastElement
+
+int(2)
+NULL
+NULL
+int(0)
diff --git a/ext/dom/tests/DOM4_ParentNode_Fragment.phpt b/ext/dom/tests/DOM4_ParentNode_Fragment.phpt
new file mode 100644
index 0000000000..4f7fee3f41
--- /dev/null
+++ b/ext/dom/tests/DOM4_ParentNode_Fragment.phpt
@@ -0,0 +1,41 @@
+--TEST--
+DOMParentNode: Child Element Handling
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML('<test></test>');
+
+$fragment = $dom->createDocumentFragment();
+$fragment->appendChild($dom->createTextNode('foo'));
+$fragment->appendChild($dom->createElement('bar', 'FirstElement'));
+$fragment->appendChild($dom->createElement('bar', 'LastElement'));
+$fragment->appendChild($dom->createTextNode('bar'));
+
+var_dump($fragment instanceof DOMParentNode);
+print_node($fragment->firstElementChild);
+print_node($fragment->lastElementChild);
+var_dump($fragment->childElementCount);
+var_dump($fragment->lastElementChild->firstElementChild);
+var_dump($fragment->lastElementChild->lastElementChild);
+var_dump($fragment->lastElementChild->childElementCount);
+?>
+--EXPECT--
+bool(true)
+Node Name: bar
+Node Type: 1
+Num Children: 1
+Node Content: FirstElement
+
+Node Name: bar
+Node Type: 1
+Num Children: 1
+Node Content: LastElement
+
+int(2)
+NULL
+NULL
+int(0)
diff --git a/ext/dom/tests/DOM4_ParentNode_append.phpt b/ext/dom/tests/DOM4_ParentNode_append.phpt
new file mode 100644
index 0000000000..2bab2a4bd6
--- /dev/null
+++ b/ext/dom/tests/DOM4_ParentNode_append.phpt
@@ -0,0 +1,41 @@
+--TEST--
+DOMParentNode::append()
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+declare(strict_types=1);
+
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML('<test><mark/><mark /><mark /></test>');
+
+$element = $dom->documentElement;
+$element->append(
+ $dom->createElement('element', 'content'),
+ 'content'
+);
+
+var_dump($dom->documentElement->childElementCount);
+print_node_list_compact($element->childNodes);
+
+$element->append(
+ $dom->createElement('element', 'content'),
+ 'content'
+);
+var_dump($dom->documentElement->childElementCount);
+?>
+--EXPECT--
+int(4)
+<mark>
+</mark>
+<mark>
+</mark>
+<mark>
+</mark>
+<element>
+ content
+</element>
+content
+int(5)
diff --git a/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt b/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt
new file mode 100644
index 0000000000..ab715caaa0
--- /dev/null
+++ b/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt
@@ -0,0 +1,18 @@
+--TEST--
+DOMParentNode::append() exception on invalid argument
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML('<test />');
+
+try {
+ $dom->documentElement->append(array());
+} catch(TypeError $e) {
+ echo "OK! {$e->getMessage()}";
+}
+--EXPECT--
+OK! Invalid argument type must be either DOMNode or string
diff --git a/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt b/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt
new file mode 100644
index 0000000000..3fb266729a
--- /dev/null
+++ b/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt
@@ -0,0 +1,26 @@
+--TEST--
+DOMParentNode::append() with attributes
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML('<test attr-one="21"/>');
+
+$replacement = $dom->createAttribute('attr-one');
+$replacement->value ='42';
+$addition = $dom->createAttribute('attr-two');
+$addition->value = '23';
+
+$element = $dom->documentElement;
+
+try {
+ $element->append($replacement, $addition);
+} catch (DOMException $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
+Hierarchy Request Error
diff --git a/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt b/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt
new file mode 100644
index 0000000000..8d5be4373e
--- /dev/null
+++ b/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DOMParentNode::append() with DOMNode from wrong document throws exception
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom1 = new DOMDocument;
+$dom1->loadXML('<test/>');
+
+$dom2 = new DOMDocument;
+$dom2->loadXML('<test><foo /></test>');
+
+$element = $dom1->documentElement;
+
+try {
+ $element->append($dom2->documentElement->firstChild);
+ echo "FAIL";
+} catch (DOMException $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $element->prepend($dom2->documentElement->firstChild);
+ echo "FAIL";
+} catch (DOMException $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
+Wrong Document Error
+Wrong Document Error
diff --git a/ext/dom/tests/DOM4_ParentNode_prepend.phpt b/ext/dom/tests/DOM4_ParentNode_prepend.phpt
new file mode 100644
index 0000000000..6b6ad2f538
--- /dev/null
+++ b/ext/dom/tests/DOM4_ParentNode_prepend.phpt
@@ -0,0 +1,49 @@
+--TEST--
+DOMParentNode::prepend()
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+declare(strict_types=1);
+
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML('<test><mark/><mark><nested /></mark><mark/></test>');
+
+$element = $dom->documentElement;
+$firstMark = $element->childNodes[0];
+$element->prepend(
+ $dom->createElement('element', 'content'),
+ 'content'
+);
+
+var_dump($element->childElementCount);
+print_node_list_compact($element->childNodes);
+
+$element = $dom->documentElement;
+$element->prepend(
+ $dom->createElement('element', 'content'),
+ 'content'
+);
+var_dump($element->childElementCount);
+
+$firstMark->prepend('content');
+print_node_list_compact($firstMark->childNodes);
+?>
+--EXPECT--
+int(4)
+<element>
+ content
+</element>
+content
+<mark>
+</mark>
+<mark>
+ <nested>
+ </nested>
+</mark>
+<mark>
+</mark>
+int(5)
+content
diff --git a/ext/dom/tests/bug69846.phpt b/ext/dom/tests/bug69846.phpt
index 74db47c571..a47d30a057 100644
--- a/ext/dom/tests/bug69846.phpt
+++ b/ext/dom/tests/bug69846.phpt
@@ -30,7 +30,7 @@ foreach ($dataNodes AS $node) {
?>
--EXPECTF--
int(3)
-object(DOMText)#%d (19) {
+object(DOMText)#%d (21) {
["wholeText"]=>
string(3) "
"
@@ -39,6 +39,10 @@ object(DOMText)#%d (19) {
"
["length"]=>
int(3)
+ ["previousElementSibling"]=>
+ NULL
+ ["nextElementSibling"]=>
+ NULL
["nodeName"]=>
string(5) "#text"
["nodeValue"]=>
@@ -74,11 +78,21 @@ object(DOMText)#%d (19) {
string(3) "
"
}
-object(DOMElement)#%d (18) {
+object(DOMElement)#%d (23) {
["tagName"]=>
string(5) "form1"
["schemaTypeInfo"]=>
NULL
+ ["firstElementChild"]=>
+ string(22) "(object value omitted)"
+ ["lastElementChild"]=>
+ string(22) "(object value omitted)"
+ ["childElementCount"]=>
+ int(3)
+ ["previousElementSibling"]=>
+ NULL
+ ["nextElementSibling"]=>
+ NULL
["nodeName"]=>
string(5) "form1"
["nodeValue"]=>
@@ -120,7 +134,7 @@ object(DOMElement)#%d (18) {
Value C
"
}
-object(DOMText)#%d (19) {
+object(DOMText)#%d (21) {
["wholeText"]=>
string(1) "
"
@@ -129,6 +143,10 @@ object(DOMText)#%d (19) {
"
["length"]=>
int(1)
+ ["previousElementSibling"]=>
+ NULL
+ ["nextElementSibling"]=>
+ NULL
["nodeName"]=>
string(5) "#text"
["nodeValue"]=>
diff --git a/ext/dom/tests/dom_test.inc b/ext/dom/tests/dom_test.inc
index 93264ea2aa..04bfa04d53 100644
--- a/ext/dom/tests/dom_test.inc
+++ b/ext/dom/tests/dom_test.inc
@@ -48,4 +48,22 @@ function print_node_list($nodelist)
}
}
+function print_node_compact($node, $spaces)
+{
+ if ($node->nodeType == 3) {
+ print str_repeat(" ", $spaces) . trim($node->nodeValue) . "\n";
+ } else {
+ print str_repeat(" ", $spaces) . "<" . $node->nodeName . ">\n";
+ print_node_list_compact($node->childNodes, $spaces + 2);
+ print str_repeat(" ", $spaces) . "</" . $node->nodeName . ">\n";
+ }
+}
+
+function print_node_list_compact($nodelist, $spaces = 0)
+{
+ foreach ($nodelist as $node) {
+ print_node_compact($node, $spaces);
+ }
+}
+
?>
diff --git a/ext/dom/tests/domobject_debug_handler.phpt b/ext/dom/tests/domobject_debug_handler.phpt
index d2834e815c..3545b78dd4 100644
--- a/ext/dom/tests/domobject_debug_handler.phpt
+++ b/ext/dom/tests/domobject_debug_handler.phpt
@@ -39,6 +39,9 @@ DOMDocument Object
[preserveWhiteSpace] => 1
[recover] =>
[substituteEntities] =>
+ [firstElementChild] => (object value omitted)
+ [lastElementChild] => (object value omitted)
+ [childElementCount] => 1
[nodeName] => #document
[nodeValue] =>
[nodeType] => 9