diff options
Diffstat (limited to 'ext/dom/tests')
37 files changed, 0 insertions, 2444 deletions
diff --git a/ext/dom/tests/book.xml b/ext/dom/tests/book.xml deleted file mode 100644 index 95de0da866..0000000000 --- a/ext/dom/tests/book.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" ?> -<books> - <book> - <title>The Grapes of Wrath</title> - <author>John Steinbeck</author> - </book> - <book> - <title>The Pearl</title> - <author>John Steinbeck</author> - </book> -</books> diff --git a/ext/dom/tests/book.xml.gz b/ext/dom/tests/book.xml.gz Binary files differdeleted file mode 100644 index 2c97807a59..0000000000 --- a/ext/dom/tests/book.xml.gz +++ /dev/null diff --git a/ext/dom/tests/bug28721.phpt b/ext/dom/tests/bug28721.phpt deleted file mode 100644 index e8e7d867d8..0000000000 --- a/ext/dom/tests/bug28721.phpt +++ /dev/null @@ -1,485 +0,0 @@ ---TEST-- -Bug # 28721: (appendChild() and insertBefore() unset DOMText) ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -function print_node(DomNode $node) { - echo "name (value): " . $node->nodeName . " (" . $node->nodeValue . ")\n"; -} - -function print_node_r(DomNode $node) { - static $indent = ""; - echo "\n" . $indent; - print_node($node); - - echo $indent . "parent: "; - if ( $node->parentNode ) - print_node($node->parentNode); - else - echo "NULL\n"; - - echo $indent . "previousSibling: "; - if ( $node->previousSibling ) - print_node($node->previousSibling); - else - echo "NULL\n"; - - echo $indent . "nextSibling: "; - if ( $node->nextSibling ) - print_node($node->nextSibling); - else - echo "NULL\n"; - - if ( !$node->hasChildNodes() ) - return; - - foreach ($node->childNodes as $child) { - - $old_indent = $indent; - $indent .= " "; - print_node_r($child); - $indent = $old_indent; - } -} - -function err_handler($errno, $errstr, $errfile, $errline) { - echo "Error ($errno) on line $errline: $errstr\n"; -} - -// Record 'DocumentFragment is empty' warnings -set_error_handler("err_handler", E_WARNING); - -$xml = new DomDocument(); - -$p = $xml->createElement("p"); - -$p->appendChild($t1 = $xml->createTextNode(" t1 ")); -$p->appendChild($b = $xml->createElement("b")); -$b->appendChild($xml->createTextNode("X")); -$p->appendChild($t2 = $xml->createTextNode(" t2 ")); -$p->appendChild($xml->createTextNode(" xxx ")); - -print_node_r($p); - -echo "\nAppend t1 to p:\n"; -$ret = $p->appendChild($t1); - -print_node_r($p); -echo "\n"; - -echo "t1 == ret: "; -var_dump( $t1 === $ret ); - - -$d = $xml->createElement("div"); -$d->appendChild($t3 = $xml->createTextNode(" t3 ")); -$d->appendChild($b = $xml->createElement("b")); -$b->appendChild($xml->createElement("X")); -$d->appendChild($t4 = $xml->createTextNode(" t4 ")); -$d->appendChild($xml->createTextNode(" xxx ")); - -echo "\ndiv:\n"; -print_node_r($d); - -echo "\nInsert t4 before t3:\n"; - -$ret = $d->insertBefore($t4, $t3); - -print_node_r($d); -echo "\n"; - -$frag = $xml->createDocumentFragment(); - -$t5 = $frag->appendChild($xml->createTextNode(" t5 ")); -$frag->appendChild($i = $xml->createElement("i")); -$i->appendChild($xml->createTextNode(" frob ")); -$frag->appendChild($xml->createTextNOde(" t6 ")); - -echo "\np:\n"; -print_node_r($p); -echo "\nFragment:\n"; -print_node_r($frag); - -echo "\nAppending fragment to p:\n"; -$p->appendChild($frag); - -print_node_r($p); -echo "\nFragment:\n"; -print_node_r($frag); - -echo "\ndiv:\n"; -print_node_r($d); -echo "\nInserting fragment before t4\n"; -$d->insertBefore($frag, $t4); -print_node_r($d); - -echo "\np:\n"; -print_node_r($p); - -?> ---EXPECT-- - -name (value): p ( t1 X t2 xxx ) -parent: NULL -previousSibling: NULL -nextSibling: NULL - - name (value): #text ( t1 ) - parent: name (value): p ( t1 X t2 xxx ) - previousSibling: NULL - nextSibling: name (value): b (X) - - name (value): b (X) - parent: name (value): p ( t1 X t2 xxx ) - previousSibling: name (value): #text ( t1 ) - nextSibling: name (value): #text ( t2 ) - - name (value): #text (X) - parent: name (value): b (X) - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( t2 ) - parent: name (value): p ( t1 X t2 xxx ) - previousSibling: name (value): b (X) - nextSibling: name (value): #text ( xxx ) - - name (value): #text ( xxx ) - parent: name (value): p ( t1 X t2 xxx ) - previousSibling: name (value): #text ( t2 ) - nextSibling: NULL - -Append t1 to p: - -name (value): p (X t2 xxx t1 ) -parent: NULL -previousSibling: NULL -nextSibling: NULL - - name (value): b (X) - parent: name (value): p (X t2 xxx t1 ) - previousSibling: NULL - nextSibling: name (value): #text ( t2 ) - - name (value): #text (X) - parent: name (value): b (X) - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( t2 ) - parent: name (value): p (X t2 xxx t1 ) - previousSibling: name (value): b (X) - nextSibling: name (value): #text ( xxx ) - - name (value): #text ( xxx ) - parent: name (value): p (X t2 xxx t1 ) - previousSibling: name (value): #text ( t2 ) - nextSibling: name (value): #text ( t1 ) - - name (value): #text ( t1 ) - parent: name (value): p (X t2 xxx t1 ) - previousSibling: name (value): #text ( xxx ) - nextSibling: NULL - -t1 == ret: bool(true) - -div: - -name (value): div ( t3 t4 xxx ) -parent: NULL -previousSibling: NULL -nextSibling: NULL - - name (value): #text ( t3 ) - parent: name (value): div ( t3 t4 xxx ) - previousSibling: NULL - nextSibling: name (value): b () - - name (value): b () - parent: name (value): div ( t3 t4 xxx ) - previousSibling: name (value): #text ( t3 ) - nextSibling: name (value): #text ( t4 ) - - name (value): X () - parent: name (value): b () - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( t4 ) - parent: name (value): div ( t3 t4 xxx ) - previousSibling: name (value): b () - nextSibling: name (value): #text ( xxx ) - - name (value): #text ( xxx ) - parent: name (value): div ( t3 t4 xxx ) - previousSibling: name (value): #text ( t4 ) - nextSibling: NULL - -Insert t4 before t3: - -name (value): div ( t4 t3 xxx ) -parent: NULL -previousSibling: NULL -nextSibling: NULL - - name (value): #text ( t4 ) - parent: name (value): div ( t4 t3 xxx ) - previousSibling: NULL - nextSibling: name (value): #text ( t3 ) - - name (value): #text ( t3 ) - parent: name (value): div ( t4 t3 xxx ) - previousSibling: name (value): #text ( t4 ) - nextSibling: name (value): b () - - name (value): b () - parent: name (value): div ( t4 t3 xxx ) - previousSibling: name (value): #text ( t3 ) - nextSibling: name (value): #text ( xxx ) - - name (value): X () - parent: name (value): b () - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( xxx ) - parent: name (value): div ( t4 t3 xxx ) - previousSibling: name (value): b () - nextSibling: NULL - - -p: - -name (value): p (X t2 xxx t1 ) -parent: NULL -previousSibling: NULL -nextSibling: NULL - - name (value): b (X) - parent: name (value): p (X t2 xxx t1 ) - previousSibling: NULL - nextSibling: name (value): #text ( t2 ) - - name (value): #text (X) - parent: name (value): b (X) - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( t2 ) - parent: name (value): p (X t2 xxx t1 ) - previousSibling: name (value): b (X) - nextSibling: name (value): #text ( xxx ) - - name (value): #text ( xxx ) - parent: name (value): p (X t2 xxx t1 ) - previousSibling: name (value): #text ( t2 ) - nextSibling: name (value): #text ( t1 ) - - name (value): #text ( t1 ) - parent: name (value): p (X t2 xxx t1 ) - previousSibling: name (value): #text ( xxx ) - nextSibling: NULL - -Fragment: - -name (value): #document-fragment () -parent: NULL -previousSibling: NULL -nextSibling: NULL - - name (value): #text ( t5 ) - parent: name (value): #document-fragment () - previousSibling: NULL - nextSibling: name (value): i ( frob ) - - name (value): i ( frob ) - parent: name (value): #document-fragment () - previousSibling: name (value): #text ( t5 ) - nextSibling: name (value): #text ( t6 ) - - name (value): #text ( frob ) - parent: name (value): i ( frob ) - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( t6 ) - parent: name (value): #document-fragment () - previousSibling: name (value): i ( frob ) - nextSibling: NULL - -Appending fragment to p: - -name (value): p (X t2 xxx t1 t5 frob t6 ) -parent: NULL -previousSibling: NULL -nextSibling: NULL - - name (value): b (X) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: NULL - nextSibling: name (value): #text ( t2 ) - - name (value): #text (X) - parent: name (value): b (X) - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( t2 ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): b (X) - nextSibling: name (value): #text ( xxx ) - - name (value): #text ( xxx ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): #text ( t2 ) - nextSibling: name (value): #text ( t1 ) - - name (value): #text ( t1 ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): #text ( xxx ) - nextSibling: name (value): #text ( t5 ) - - name (value): #text ( t5 ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): #text ( t1 ) - nextSibling: name (value): i ( frob ) - - name (value): i ( frob ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): #text ( t5 ) - nextSibling: name (value): #text ( t6 ) - - name (value): #text ( frob ) - parent: name (value): i ( frob ) - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( t6 ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): i ( frob ) - nextSibling: NULL - -Fragment: - -name (value): #document-fragment () -parent: NULL -previousSibling: NULL -nextSibling: NULL - -div: - -name (value): div ( t4 t3 xxx ) -parent: NULL -previousSibling: NULL -nextSibling: NULL - - name (value): #text ( t4 ) - parent: name (value): div ( t4 t3 xxx ) - previousSibling: NULL - nextSibling: name (value): #text ( t3 ) - - name (value): #text ( t3 ) - parent: name (value): div ( t4 t3 xxx ) - previousSibling: name (value): #text ( t4 ) - nextSibling: name (value): b () - - name (value): b () - parent: name (value): div ( t4 t3 xxx ) - previousSibling: name (value): #text ( t3 ) - nextSibling: name (value): #text ( xxx ) - - name (value): X () - parent: name (value): b () - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( xxx ) - parent: name (value): div ( t4 t3 xxx ) - previousSibling: name (value): b () - nextSibling: NULL - -Inserting fragment before t4 -Error (2) on line 109: DOMNode::insertBefore(): Document Fragment is empty - -name (value): div ( t4 t3 xxx ) -parent: NULL -previousSibling: NULL -nextSibling: NULL - - name (value): #text ( t4 ) - parent: name (value): div ( t4 t3 xxx ) - previousSibling: NULL - nextSibling: name (value): #text ( t3 ) - - name (value): #text ( t3 ) - parent: name (value): div ( t4 t3 xxx ) - previousSibling: name (value): #text ( t4 ) - nextSibling: name (value): b () - - name (value): b () - parent: name (value): div ( t4 t3 xxx ) - previousSibling: name (value): #text ( t3 ) - nextSibling: name (value): #text ( xxx ) - - name (value): X () - parent: name (value): b () - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( xxx ) - parent: name (value): div ( t4 t3 xxx ) - previousSibling: name (value): b () - nextSibling: NULL - -p: - -name (value): p (X t2 xxx t1 t5 frob t6 ) -parent: NULL -previousSibling: NULL -nextSibling: NULL - - name (value): b (X) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: NULL - nextSibling: name (value): #text ( t2 ) - - name (value): #text (X) - parent: name (value): b (X) - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( t2 ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): b (X) - nextSibling: name (value): #text ( xxx ) - - name (value): #text ( xxx ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): #text ( t2 ) - nextSibling: name (value): #text ( t1 ) - - name (value): #text ( t1 ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): #text ( xxx ) - nextSibling: name (value): #text ( t5 ) - - name (value): #text ( t5 ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): #text ( t1 ) - nextSibling: name (value): i ( frob ) - - name (value): i ( frob ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): #text ( t5 ) - nextSibling: name (value): #text ( t6 ) - - name (value): #text ( frob ) - parent: name (value): i ( frob ) - previousSibling: NULL - nextSibling: NULL - - name (value): #text ( t6 ) - parent: name (value): p (X t2 xxx t1 t5 frob t6 ) - previousSibling: name (value): i ( frob ) - nextSibling: NULL diff --git a/ext/dom/tests/bug28817.phpt b/ext/dom/tests/bug28817.phpt deleted file mode 100644 index 26dd283c56..0000000000 --- a/ext/dom/tests/bug28817.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -Bug # 28817: (properties in extended class) ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php - -class z extends domDocument{ - /** variable can have name */ - public $p_array; - public $p_variable; - - function __construct(){ - $this->p_array[] = 'bonus'; - $this->p_array[] = 'vir'; - $this->p_array[] = 'semper'; - $this->p_array[] = 'tiro'; - - $this->p_variable = 'Cessante causa cessat effectus'; - } -} - -$z=new z(); -var_dump($z->p_array); -var_dump($z->p_variable); -?> ---EXPECTF-- -array(4) { - [0]=> - string(5) "bonus" - [1]=> - string(3) "vir" - [2]=> - string(6) "semper" - [3]=> - string(4) "tiro" -} -string(30) "Cessante causa cessat effectus" diff --git a/ext/dom/tests/bug32615.phpt b/ext/dom/tests/bug32615.phpt deleted file mode 100644 index e48973429a..0000000000 --- a/ext/dom/tests/bug32615.phpt +++ /dev/null @@ -1,84 +0,0 @@ ---TEST-- -Bug # 32615: (Replacing and inserting Fragments) ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -$dom = new DomDocument; -$frag = $dom->createDocumentFragment(); -$frag->appendChild(new DOMElement('root')); -$dom->appendChild($frag); -$root = $dom->documentElement; - -$frag->appendChild(new DOMElement('first')); -$root->appendChild($frag); - -$frag->appendChild(new DOMElement('second')); -$root->appendChild($frag); - -$node = $dom->createElement('newfirst'); -$frag->appendChild($node); -$root->replaceChild($frag, $root->firstChild); - -unset($frag); -$frag = $dom->createDocumentFragment(); - -$frag->appendChild(new DOMElement('newsecond')); -$root->replaceChild($frag, $root->lastChild); - -$node = $frag->appendChild(new DOMElement('fourth')); -$root->insertBefore($frag, NULL); - -$frag->appendChild(new DOMElement('third')); -$node = $root->insertBefore($frag, $node); - -$frag->appendChild(new DOMElement('start')); -$root->insertBefore($frag, $root->firstChild); - -$frag->appendChild(new DOMElement('newthird')); -$root->replaceChild($frag, $node); - -$frag->appendChild(new DOMElement('newfourth')); -$root->replaceChild($frag, $root->lastChild); - -$frag->appendChild(new DOMElement('first')); -$root->replaceChild($frag, $root->firstChild->nextSibling); - -$root->removeChild($root->firstChild); - -echo $dom->saveXML()."\n"; - -while ($root->hasChildNodes()) { - $root->removeChild($root->firstChild); -} - -$frag->appendChild(new DOMElement('first')); -$root->insertBefore($frag, $root->firstChild); - -$node = $frag->appendChild(new DOMElement('fourth')); -$root->appendChild($frag); - -$frag->appendChild(new DOMElement('second')); -$frag->appendChild(new DOMElement('third')); -$root->insertBefore($frag, $node); - -echo $dom->saveXML()."\n"; - -$frag = $dom->createDocumentFragment(); -$root = $dom->documentElement; -$root->replaceChild($frag, $root->firstChild); - -echo $dom->saveXML(); - -?> ---EXPECT-- - -<?xml version="1.0"?> -<root><first/><newsecond/><newthird/><newfourth/></root> - -<?xml version="1.0"?> -<root><first/><second/><third/><fourth/></root> - -<?xml version="1.0"?> -<root><second/><third/><fourth/></root> - diff --git a/ext/dom/tests/bug34276.phpt b/ext/dom/tests/bug34276.phpt deleted file mode 100644 index 4a63943f7a..0000000000 --- a/ext/dom/tests/bug34276.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -Bug # 34276: setAttributeNS and default namespace ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -$xml = <<<HERE -<?xml version="1.0" encoding="ISO-8859-1" ?> -<foo xmlns="http://www.example.com/ns/foo" - xmlns:fubar="http://www.example.com/ns/fubar" attra="attra" /> -HERE; - -function dump($elems) { - foreach ($elems as $elem) { - var_dump($elem->nodeName); - dump($elem->childNodes); - } -} - -$dom = new DOMDocument(); -$dom->loadXML($xml); -$foo = $dom->documentElement; -var_dump($foo->hasAttributeNS('http://www.example.com/ns/foo', 'attra')); -var_dump($foo->getAttributeNS('http://www.example.com/ns/foo', 'attra')); - -$foo->setAttributeNS('http://www.example.com/ns/foo', 'attra', 'attranew'); -$foo->setAttributeNS('http://www.example.com/ns/fubar', 'attrb', 'attrbnew'); -$foo->setAttributeNS('http://www.example.com/ns/foo', 'attrc', 'attrc'); - -var_dump($foo->getAttributeNS('http://www.example.com/ns/foo', 'attra')); -var_dump($foo->getAttributeNS('http://www.example.com/ns/fubar', 'attrb')); -var_dump($foo->getAttributeNS('http://www.example.com/ns/foo', 'attrc')); - -print $dom->saveXML(); -?> ---EXPECT-- -bool(false) -string(0) "" -string(8) "attranew" -string(8) "attrbnew" -string(5) "attrc" -<?xml version="1.0" encoding="ISO-8859-1"?> -<foo xmlns="http://www.example.com/ns/foo" xmlns:fubar="http://www.example.com/ns/fubar" xmlns:default="http://www.example.com/ns/foo" attra="attra" default:attra="attranew" fubar:attrb="attrbnew" default:attrc="attrc"/> diff --git a/ext/dom/tests/bug35342.phpt b/ext/dom/tests/bug35342.phpt deleted file mode 100644 index c07fd340dc..0000000000 --- a/ext/dom/tests/bug35342.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Bug # 35342: isset(DOMNodeList->length) returns false ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -$dom = new DOMDocument(); -$dom->loadXML("<root><foo>foobar</foo><foo>foobar#2</foo></root>"); - -$nodelist = $dom->getElementsByTagName("foo"); - -var_dump($nodelist->length, isset($nodelist->length), isset($nodelist->foo)); -?> ---EXPECT-- -int(2) -bool(true) -bool(false) diff --git a/ext/dom/tests/bug36756.phpt b/ext/dom/tests/bug36756.phpt deleted file mode 100644 index e24f9f0804..0000000000 --- a/ext/dom/tests/bug36756.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -Bug #36756: (DOMDocument::removeChild corrupts node) ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php - -/* Node is preserved from removeChild */ -$dom = new DOMDocument(); -$dom->loadXML('<root><child/></root>'); -$xpath = new DOMXpath($dom); -$node = $xpath->query('/root')->item(0); -echo $node->nodeName . "\n"; -$dom->removeChild($GLOBALS['dom']->firstChild); -echo "nodeType: " . $node->nodeType . "\n"; - -/* Node gets destroyed during removeChild */ -$dom->loadXML('<root><child/></root>'); -$xpath = new DOMXpath($dom); -$node = $xpath->query('//child')->item(0); -echo $node->nodeName . "\n"; -$GLOBALS['dom']->removeChild($GLOBALS['dom']->firstChild); - -echo "nodeType: " . $node->nodeType . "\n"; - -?> ---EXPECTF-- -root -nodeType: 1 -child - -Warning: Couldn't fetch DOMElement. Node no longer exists in %sbug36756.php on line %d - -Notice: Undefined property: DOMElement::$nodeType in %sbug36756.php on line %d -nodeType: diff --git a/ext/dom/tests/bug37277.phpt b/ext/dom/tests/bug37277.phpt deleted file mode 100644 index 4a01684171..0000000000 --- a/ext/dom/tests/bug37277.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug # 37277 (cloning Dom Documents or Nodes does not work) ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -$dom1 = new DomDocument('1.0', 'UTF-8'); - -$xml = '<foo />'; -$dom1->loadXml($xml); - -$node = clone $dom1->documentElement; - -$dom2 = new DomDocument('1.0', 'UTF-8'); -$dom2->appendChild($dom2->importNode($node->cloneNode(true), TRUE)); - -print $dom2->saveXML(); - - -?> ---EXPECT-- - -<?xml version="1.0" encoding="UTF-8"?> -<foo/> - diff --git a/ext/dom/tests/bug37456.phpt b/ext/dom/tests/bug37456.phpt deleted file mode 100644 index 904712f4b1..0000000000 --- a/ext/dom/tests/bug37456.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Bug # 37456 (DOMElement->setAttribute() loops forever) ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php - -$doc = new DOMDocument(); -$doc->resolveExternals = true; -$doc->load(dirname(__FILE__)."/dom.xml"); - -$root = $doc->getElementsByTagName('foo')->item(0); -$root->setAttribute('bar', '>'); -$attr = $root->setAttribute('bar', 'newval'); -print $attr->nodeValue; - - -?> ---EXPECT-- - -newval - diff --git a/ext/dom/tests/bug38438.phpt b/ext/dom/tests/bug38438.phpt deleted file mode 100644 index f51252832c..0000000000 --- a/ext/dom/tests/bug38438.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Bug #38438 (DOMNodeList->item(0) segfault on empty NodeList) ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -$list = new DOMNodeList(); -var_dump($list->item(0)); -echo "OK\n"; -?> ---EXPECT-- -NULL -OK diff --git a/ext/dom/tests/bug38474.phpt b/ext/dom/tests/bug38474.phpt deleted file mode 100644 index 7e7aa5c0cb..0000000000 --- a/ext/dom/tests/bug38474.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Bug #38474 (getAttribute select attribute by order, even when prefixed) ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -$xml = '<node xmlns:pre="http://foo.com/tr/pre" - xmlns:post="http://foo.com/tr/post" - pre:type="bar" type="foo" ><sub /></node>'; -$dom = new DomDocument(); -$dom->loadXML($xml); -echo $dom->firstChild->getAttribute('type')."\n"; -echo $dom->firstChild->getAttribute('pre:type')."\n"; - -$dom->firstChild->setAttribute('pre:type', 'bar2'); -$dom->firstChild->setAttribute('type', 'foo2'); -$dom->firstChild->setAttribute('post:type', 'baz'); -$dom->firstChild->setAttribute('new:type', 'baz2'); - -echo $dom->firstChild->getAttribute('type')."\n"; -echo $dom->firstChild->getAttribute('pre:type')."\n"; -echo $dom->firstChild->getAttribute('post:type')."\n"; - -$dom->firstChild->removeAttribute('pre:type'); -$dom->firstChild->removeAttribute('type'); - -echo $dom->firstChild->getAttribute('type')."\n"; -echo $dom->firstChild->getAttribute('pre:type')."\n"; -echo $dom->firstChild->getAttribute('post:type')."\n"; -echo $dom->firstChild->getAttribute('new:type'); -?> ---EXPECT-- -foo -bar -foo2 -bar2 -baz - - -baz -baz2 diff --git a/ext/dom/tests/bug38850.phpt b/ext/dom/tests/bug38850.phpt deleted file mode 100644 index c8ca939282..0000000000 --- a/ext/dom/tests/bug38850.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Bug # 38850 (lookupNamespaceURI does not return default namespace) ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -$xml = <<<HERE -<?xml version="1.0" ?> -<foo xmlns="http://www.example.com/ns/foo" /> -HERE; - -$doc = new DOMDocument(); -$doc->loadXML($xml); - -$root = $doc->documentElement; - -print $root->lookupNamespaceURI(NULL); - - -?> ---EXPECT-- -http://www.example.com/ns/foo diff --git a/ext/dom/tests/bug38949.phpt b/ext/dom/tests/bug38949.phpt deleted file mode 100644 index ba9c8dfe36..0000000000 --- a/ext/dom/tests/bug38949.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Bug # 38949: (Cannot get xmlns value attribute) ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php - -$doc = new DOMDocument(); -$doc->load(dirname(__FILE__)."/nsdoc.xml"); - -$root = $doc->documentElement; - -echo $root->getAttribute("xmlns")."\n"; -echo $root->getAttribute("xmlns:ns2")."\n"; - -$child = $root->firstChild->nextSibling; -echo $child->getAttribute("xmlns")."\n"; -echo $child->getAttribute("xmlns:ns2")."\n"; - -echo "DONE\n"; -?> ---EXPECT-- -http://ns -http://ns2 - - -DONE diff --git a/ext/dom/tests/canonicalization.phpt b/ext/dom/tests/canonicalization.phpt deleted file mode 100644 index cf1a81f24a..0000000000 --- a/ext/dom/tests/canonicalization.phpt +++ /dev/null @@ -1,102 +0,0 @@ ---TEST-- -Test: Canonicalization - C14N() ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -$xml = <<<EOXML -<?xml version="1.0" encoding="ISO-8859-1" ?> -<foo xmlns="http://www.example.com/ns/foo" - xmlns:fubar="http://www.example.com/ns/fubar" xmlns:test="urn::test"><contain> - <bar><test1 /></bar> - <bar><test2 /></bar> - <fubar:bar xmlns:fubar="http://www.example.com/ns/fubar"><test3 /></fubar:bar> - <fubar:bar><test4 /></fubar:bar> -<!-- this is a comment --> -</contain> -</foo> -EOXML; - -$dom = new DOMDocument(); -$dom->loadXML($xml); -$doc = $dom->documentElement->firstChild; - -/* inclusive/without comments first child element of doc element is context. */ -echo $doc->C14N()."\n\n"; - -/* exclusive/without comments first child element of doc element is context. */ -echo $doc->c14N(TRUE)."\n\n"; - -/* inclusive/with comments first child element of doc element is context. */ -echo $doc->C14N(FALSE, TRUE)."\n\n"; - -/* exclusive/with comments first child element of doc element is context. */ -echo $doc->C14N(TRUE, TRUE)."\n\n"; - -/* exclusive/without comments using xpath query. */ -echo $doc->c14N(TRUE, FALSE, array('query'=>'(//. | //@* | //namespace::*)'))."\n\n"; - -/* exclusive/without comments first child element of doc element is context. - using xpath query with registered namespace. - test namespace prefix is also included. */ -echo $doc->c14N(TRUE, FALSE, - array('query'=>'(//a:contain | //a:bar | .//namespace::*)', - 'namespaces'=>array('a'=>'http://www.example.com/ns/foo')), - array('test'))."\n\n"; - -/* exclusive/without comments first child element of doc element is context. - test namespace prefix is also included */ -echo $doc->C14N(TRUE, FALSE, NULL, array('test')); -?> ---EXPECTF-- - -<contain xmlns="http://www.example.com/ns/foo" xmlns:fubar="http://www.example.com/ns/fubar" xmlns:test="urn::test"> - <bar><test1></test1></bar> - <bar><test2></test2></bar> - <fubar:bar><test3></test3></fubar:bar> - <fubar:bar><test4></test4></fubar:bar> - -</contain> - -<contain xmlns="http://www.example.com/ns/foo"> - <bar><test1></test1></bar> - <bar><test2></test2></bar> - <fubar:bar xmlns:fubar="http://www.example.com/ns/fubar"><test3></test3></fubar:bar> - <fubar:bar xmlns:fubar="http://www.example.com/ns/fubar"><test4></test4></fubar:bar> - -</contain> - -<contain xmlns="http://www.example.com/ns/foo" xmlns:fubar="http://www.example.com/ns/fubar" xmlns:test="urn::test"> - <bar><test1></test1></bar> - <bar><test2></test2></bar> - <fubar:bar><test3></test3></fubar:bar> - <fubar:bar><test4></test4></fubar:bar> -<!-- this is a comment --> -</contain> - -<contain xmlns="http://www.example.com/ns/foo"> - <bar><test1></test1></bar> - <bar><test2></test2></bar> - <fubar:bar xmlns:fubar="http://www.example.com/ns/fubar"><test3></test3></fubar:bar> - <fubar:bar xmlns:fubar="http://www.example.com/ns/fubar"><test4></test4></fubar:bar> -<!-- this is a comment --> -</contain> - -<foo xmlns="http://www.example.com/ns/foo"><contain> - <bar><test1></test1></bar> - <bar><test2></test2></bar> - <fubar:bar xmlns:fubar="http://www.example.com/ns/fubar"><test3></test3></fubar:bar> - <fubar:bar xmlns:fubar="http://www.example.com/ns/fubar"><test4></test4></fubar:bar> - -</contain> -</foo> - -<contain xmlns="http://www.example.com/ns/foo" xmlns:test="urn::test"><bar></bar><bar></bar></contain> - -<contain xmlns="http://www.example.com/ns/foo" xmlns:test="urn::test"> - <bar><test1></test1></bar> - <bar><test2></test2></bar> - <fubar:bar xmlns:fubar="http://www.example.com/ns/fubar"><test3></test3></fubar:bar> - <fubar:bar xmlns:fubar="http://www.example.com/ns/fubar"><test4></test4></fubar:bar> - -</contain> diff --git a/ext/dom/tests/dom.ent b/ext/dom/tests/dom.ent deleted file mode 100644 index 987ff9dc0f..0000000000 --- a/ext/dom/tests/dom.ent +++ /dev/null @@ -1,8 +0,0 @@ -<!ENTITY amp "&#38;"> -<!ENTITY gt ">"> -<!ENTITY % coreattrs "title CDATA #IMPLIED"> -<!ENTITY % attrs "%coreattrs;"> -<!ATTLIST foo bar CDATA #IMPLIED> -<!ELEMENT foo (#PCDATA)> -<!ELEMENT root (foo)+> -<!ATTLIST th %attrs; >
\ No newline at end of file diff --git a/ext/dom/tests/dom.xml b/ext/dom/tests/dom.xml deleted file mode 100644 index 09ac674e55..0000000000 --- a/ext/dom/tests/dom.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE root [ -<!ENTITY % incent SYSTEM "dom.ent"> -%incent; -]> -<root> - <foo bar="" /> -</root>
\ No newline at end of file diff --git a/ext/dom/tests/dom001.phpt b/ext/dom/tests/dom001.phpt deleted file mode 100644 index a0c78fbb0a..0000000000 --- a/ext/dom/tests/dom001.phpt +++ /dev/null @@ -1,275 +0,0 @@ ---TEST-- -Test 1: Accessing single node ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require_once("dom_test.inc"); - -echo "Test 1: accessing single nodes from php\n"; -$dom = new domDocument; -$dom->loadxml($xmlstr); -if(!$dom) { - echo "Error while parsing the document\n"; - exit; -} - -// children() of of document would result in a memleak -//$children = $dom->children(); -//print_node_list($children); - -echo "--------- root\n"; -$rootnode = $dom->documentElement; -print_node($rootnode); - -echo "--------- children of root\n"; -$children = $rootnode->childNodes; -print_node_list($children); - -// The last node should be identical with the last entry in the children array -echo "--------- last\n"; -$last = $rootnode->lastChild; -print_node($last); - -// The parent of this last node is the root again -echo "--------- parent\n"; -$parent = $last->parentNode; -print_node($parent); - -// The children of this parent are the same children as one above -echo "--------- children of parent\n"; -$children = $parent->childNodes; -print_node_list($children); - -echo "--------- creating a new attribute\n"; -//This is worthless -//$attr = $dom->createAttribute("src", "picture.gif"); -//print_r($attr); - -//$rootnode->set_attributeNode($attr); -$attr = $rootnode->setAttribute("src", "picture.gif"); -$attr = $rootnode->getAttribute("src"); -print_r($attr); -print "\n"; - -echo "--------- Get Attribute Node\n"; -$attr = $rootnode->getAttributeNode("src"); -print_node($attr); - -echo "--------- Remove Attribute Node\n"; -$attr = $rootnode->removeAttribute("src"); -print "Removed " . $attr . " attributes.\n"; - -echo "--------- attributes of rootnode\n"; -$attrs = $rootnode->attributes; -print_node_list($attrs); - -echo "--------- children of an attribute\n"; -$children = $attrs->item(0)->childNodes; -print_node_list($children); - -echo "--------- Add child to root\n"; -$myelement = new domElement("Silly", "Symphony"); -$newchild = $rootnode->appendChild($myelement); -print_node($newchild); -print $dom->saveXML(); -print "\n"; - -echo "--------- Find element by tagname\n"; -echo " Using dom\n"; -$children = $dom->getElementsByTagname("Silly"); -print_node_list($children); - -echo " Using elem\n"; -$children = $rootnode->getElementsByTagName("Silly"); -print_node_list($children); - -echo "--------- Unlink Node\n"; -print_node($children->item(0)); -$rootnode->removeChild($children->item(0)); -print_node_list($rootnode->childNodes); -print $dom->savexml(); - -echo "--------- Find element by id\n"; -print ("Not implemented\n"); - -echo "--------- Check various node_name return values\n"; -print ("Not needed\n"); - -?> ---EXPECT-- -Test 1: accessing single nodes from php ---------- root -Node Name: chapter -Node Type: 1 -Num Children: 4 - ---------- children of root -Node Name: title -Node Type: 1 -Num Children: 1 -Node Content: Title - -Node Name: #text -Node Type: 3 -Num Children: 0 -Node Content: - - -Node Name: para -Node Type: 1 -Num Children: 7 - -Node Name: #text -Node Type: 3 -Num Children: 0 -Node Content: - - ---------- last -Node Name: #text -Node Type: 3 -Num Children: 0 -Node Content: - - ---------- parent -Node Name: chapter -Node Type: 1 -Num Children: 4 - ---------- children of parent -Node Name: title -Node Type: 1 -Num Children: 1 -Node Content: Title - -Node Name: #text -Node Type: 3 -Num Children: 0 -Node Content: - - -Node Name: para -Node Type: 1 -Num Children: 7 - -Node Name: #text -Node Type: 3 -Num Children: 0 -Node Content: - - ---------- creating a new attribute -picture.gif ---------- Get Attribute Node -Node Name: src -Node Type: 2 -Num Children: 1 -Node Content: picture.gif - ---------- Remove Attribute Node -Removed 1 attributes. ---------- attributes of rootnode -Node Name: language -Node Type: 2 -Num Children: 1 -Node Content: en - ---------- children of an attribute -Node Name: #text -Node Type: 3 -Num Children: 0 -Node Content: en - ---------- Add child to root -Node Name: Silly -Node Type: 1 -Num Children: 1 -Node Content: Symphony - -<?xml version="1.0" standalone="yes"?> -<!DOCTYPE chapter SYSTEM "/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd" [ -<!ENTITY sp "spanish"> -]> -<!-- lsfj --> -<chapter language="en"><title language="en">Title</title> -<para language="ge"> -&sp; -<!-- comment --> -<informaltable language="&sp;kkk"> -<tgroup cols="3"> -<tbody> -<row><entry>a1</entry><entry morerows="1">b1</entry><entry>c1</entry></row> -<row><entry>a2</entry><entry>c2</entry></row> -<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row> -</tbody> -</tgroup> -</informaltable> -</para> -<Silly>Symphony</Silly></chapter> - ---------- Find element by tagname - Using dom -Node Name: Silly -Node Type: 1 -Num Children: 1 -Node Content: Symphony - - Using elem -Node Name: Silly -Node Type: 1 -Num Children: 1 -Node Content: Symphony - ---------- Unlink Node -Node Name: Silly -Node Type: 1 -Num Children: 1 -Node Content: Symphony - -Node Name: title -Node Type: 1 -Num Children: 1 -Node Content: Title - -Node Name: #text -Node Type: 3 -Num Children: 0 -Node Content: - - -Node Name: para -Node Type: 1 -Num Children: 7 - -Node Name: #text -Node Type: 3 -Num Children: 0 -Node Content: - - -<?xml version="1.0" standalone="yes"?> -<!DOCTYPE chapter SYSTEM "/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd" [ -<!ENTITY sp "spanish"> -]> -<!-- lsfj --> -<chapter language="en"><title language="en">Title</title> -<para language="ge"> -&sp; -<!-- comment --> -<informaltable language="&sp;kkk"> -<tgroup cols="3"> -<tbody> -<row><entry>a1</entry><entry morerows="1">b1</entry><entry>c1</entry></row> -<row><entry>a2</entry><entry>c2</entry></row> -<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row> -</tbody> -</tgroup> -</informaltable> -</para> -</chapter> ---------- Find element by id -Not implemented ---------- Check various node_name return values -Not needed diff --git a/ext/dom/tests/dom002.phpt b/ext/dom/tests/dom002.phpt deleted file mode 100644 index 3343a1774e..0000000000 --- a/ext/dom/tests/dom002.phpt +++ /dev/null @@ -1,57 +0,0 @@ ---TEST-- -Test 2: getElementsByTagName() / getElementsByTagNameNS() ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -$xml = <<<HERE -<?xml version="1.0" encoding="ISO-8859-1" ?> -<foo xmlns="http://www.example.com/ns/foo" - xmlns:fubar="http://www.example.com/ns/fubar"> - <bar><test1 /></bar> - <bar><test2 /></bar> - <fubar:bar><test3 /></fubar:bar> - <fubar:bar><test4 /></fubar:bar> -</foo> -HERE; - -function dump($elems) { - foreach ($elems as $elem) { - var_dump($elem->nodeName); - dump($elem->childNodes); - } -} - -$dom = new DOMDocument(); -$dom->loadXML($xml); -$doc = $dom->documentElement; -dump($dom->getElementsByTagName('bar')); -dump($doc->getElementsByTagName('bar')); -dump($dom->getElementsByTagNameNS('http://www.example.com/ns/fubar', 'bar')); -dump($doc->getElementsByTagNameNS('http://www.example.com/ns/fubar', 'bar')); -?> ---EXPECT-- -string(3) "bar" -string(5) "test1" -string(3) "bar" -string(5) "test2" -string(9) "fubar:bar" -string(5) "test3" -string(9) "fubar:bar" -string(5) "test4" -string(3) "bar" -string(5) "test1" -string(3) "bar" -string(5) "test2" -string(9) "fubar:bar" -string(5) "test3" -string(9) "fubar:bar" -string(5) "test4" -string(9) "fubar:bar" -string(5) "test3" -string(9) "fubar:bar" -string(5) "test4" -string(9) "fubar:bar" -string(5) "test3" -string(9) "fubar:bar" -string(5) "test4" diff --git a/ext/dom/tests/dom003.phpt b/ext/dom/tests/dom003.phpt deleted file mode 100644 index 1eb6d4a4f7..0000000000 --- a/ext/dom/tests/dom003.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -Test 3: Exception Test ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php - -$dom = new domdocument; -$dom->load(dirname(__FILE__)."/book.xml"); -$rootNode = $dom->documentElement; -print "--- Catch exception with try/catch\n"; -try { - $rootNode->appendChild($rootNode); -} catch (domexception $e) { - var_dump($e); -} -print "--- Don't catch exception with try/catch\n"; -$rootNode->appendChild($rootNode); - - -?> ---EXPECTF-- ---- Catch exception with try/catch -object(DOMException)#%d (6) { - ["message:protected"]=> - string(23) "Hierarchy Request Error" - ["string:private"]=> - string(0) "" - ["file:protected"]=> - string(%d) "%sdom003.php" - ["line:protected"]=> - int(8) - ["trace:private"]=> - array(1) { - [0]=> - array(6) { - ["file"]=> - string(%d) "%sdom003.php" - ["line"]=> - int(8) - ["function"]=> - string(11) "appendChild" - ["class"]=> - string(7) "DOMNode" - ["type"]=> - string(2) "->" - ["args"]=> - array(1) { - [0]=> - object(DOMElement)#%d (0) { - } - } - } - } - ["code"]=> - int(3) -} ---- Don't catch exception with try/catch - -Fatal error: Uncaught exception 'DOMException' with message 'Hierarchy Request Error' in %sdom003.php:%d -Stack trace: -#0 %sdom003.php(13): DOMNode->appendChild(Object(DOMElement)) -#1 {main} - thrown in %sdom003.php on line %d diff --git a/ext/dom/tests/dom004.phpt b/ext/dom/tests/dom004.phpt deleted file mode 100644 index 82b7915f6f..0000000000 --- a/ext/dom/tests/dom004.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Test 4: Streams Test ---SKIPIF-- -<?php -require_once('skipif.inc'); -array_search('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrapper is not available'); -?> ---FILE-- -<?php -$dom = new domdocument; -$dom->load("compress.zlib://".dirname(__FILE__)."/book.xml.gz"); -print $dom->saveXML(); - ---EXPECT-- -<?xml version="1.0"?> -<books> - <book> - <title>The Grapes of Wrath</title> - <author>John Steinbeck</author> - </book> - <book> - <title>The Pearl</title> - <author>John Steinbeck</author> - </book> -</books> diff --git a/ext/dom/tests/dom005.phpt b/ext/dom/tests/dom005.phpt deleted file mode 100644 index 249869eff2..0000000000 --- a/ext/dom/tests/dom005.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Test 5: HTML Test ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -$dom = new domdocument; -$dom->loadHTMLFile(dirname(__FILE__)."/test.html"); -print "--- save as XML\n"; - -print adjustDoctype($dom->saveXML()); -print "--- save as HTML\n"; - -print adjustDoctype($dom->saveHTML()); - -function adjustDoctype($xml) { - return str_replace(array("DOCTYPE HTML",'<p>','</p>'),array("DOCTYPE html",'',''),$xml); -} - ---EXPECT-- ---- save as XML -<?xml version="1.0" standalone="yes"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> -<html><head><title>Hello world</title></head><body> -This is a not well-formed<br/> -html files with undeclared entities  -</body></html> ---- save as HTML -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> -<html> -<head><title>Hello world</title></head> -<body> -This is a not well-formed<br> -html files with undeclared entities -</body> -</html> diff --git a/ext/dom/tests/dom006.phpt b/ext/dom/tests/dom006.phpt deleted file mode 100644 index b8e8ed1724..0000000000 --- a/ext/dom/tests/dom006.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Test 6: Extends Test ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php - -Class books extends domDocument { - function addBook($title, $author) { - $titleElement = $this->createElement("title"); - $titleElement->appendChild($this->createTextNode($title)); - $authorElement = $this->createElement("author"); - $authorElement->appendChild($this->createTextNode($author)); - - $bookElement = $this->createElement("book"); - - $bookElement->appendChild($titleElement); - $bookElement->appendChild($authorElement); - $this->documentElement->appendChild($bookElement); - } - -} - -$dom = new books; - -$dom->load(dirname(__FILE__)."/book.xml"); -$dom->addBook("PHP de Luxe", "Richard Samar, Christian Stocker"); -print $dom->saveXML(); ---EXPECT-- -<?xml version="1.0"?> -<books> - <book> - <title>The Grapes of Wrath</title> - <author>John Steinbeck</author> - </book> - <book> - <title>The Pearl</title> - <author>John Steinbeck</author> - </book> -<book><title>PHP de Luxe</title><author>Richard Samar, Christian Stocker</author></book></books> diff --git a/ext/dom/tests/dom007.phpt b/ext/dom/tests/dom007.phpt deleted file mode 100644 index 649d630336..0000000000 --- a/ext/dom/tests/dom007.phpt +++ /dev/null @@ -1,99 +0,0 @@ ---TEST-- -Test 7: DTD tests ---SKIPIF-- -<?php -require_once('skipif.inc'); -?> ---FILE-- -<?php -$xml = <<< EOXML -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE courses [ -<!ELEMENT courses (course+)> -<!ELEMENT course (title, description, temp*)> -<!ATTLIST course cid ID #REQUIRED> -<!ELEMENT title (#PCDATA)> -<!ELEMENT description (#PCDATA)> -<!ELEMENT temp (#PCDATA)> -<!ATTLIST temp vid ID #REQUIRED> -<!ENTITY test 'http://www.hpl.hp.com/semweb/2003/query_tester#'> -<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> -<!NOTATION GIF PUBLIC "-" "image/gif"> -<!ENTITY myimage PUBLIC "-" "mypicture.gif" NDATA GIF> -]> -<courses> - <course cid="c1"> - <title>Basic Languages</title> - <description>Introduction to Languages</description> - </course> - <course cid="c6"> - <title>French I</title> - <description>Introduction to French</description> - <temp vid="c7"> - </temp> - </course> -</courses> -EOXML; - -$dom = new DOMDocument(); -$dom->loadXML($xml); - -$dtd = $dom->doctype; - -/* Notation Tests */ -$nots = $dtd->notations; - -$length = $nots->length; -echo "Length: ".$length."\n"; - -foreach ($nots AS $key=>$node) { - echo "Key $key: ".$node->nodeName." (".$node->systemId.") (".$node->publicId.")\n"; -} -print "\n"; -for($x=0; $x < $length; $x++) { - echo "Index $x: ".$nots->item($x)->nodeName." (".$nots->item($x)->systemId.") (".$nots->item($x)->publicId.")\n"; -} - -echo "\n"; -$node = $nots->getNamedItem('xxx'); -var_dump($node); - -echo "\n"; -/* Entity Decl Tests */ -$ents = $dtd->entities; -$length = $ents->length; -echo "Length: ".$length."\n"; -foreach ($ents AS $key=>$node) { - echo "Key: $key Name: ".$node->nodeName."\n"; -} -echo "\n"; -for($x=0; $x < $length; $x++) { - echo "Index $x: ".$ents->item($x)->nodeName."\n"; -} - -echo "\n"; -$node = $ents->item(3); -var_dump($node); -$node = $ents->getNamedItem('xxx'); -var_dump($node); - - ---EXPECT-- -Length: 1 -Key GIF: GIF (image/gif) (-) - -Index 0: GIF (image/gif) (-) - -NULL - -Length: 3 -Key: test Name: test -Key: rdf Name: rdf -Key: myimage Name: myimage - -Index 0: test -Index 1: rdf -Index 2: myimage - -NULL -NULL diff --git a/ext/dom/tests/dom_create_element.phpt b/ext/dom/tests/dom_create_element.phpt deleted file mode 100644 index 3f307099bb..0000000000 --- a/ext/dom/tests/dom_create_element.phpt +++ /dev/null @@ -1,394 +0,0 @@ ---TEST-- -Test 1: Creating Elements with and without Namespaces ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php - -print " 1 DOMDocument::createElement('valid')\n"; -try { - $dom = new domDocument; - $dom->createElement('valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print " 2 DOMDocument::createElement('-invalid')\n"; -try { - $dom = new domDocument; - $dom->createElement('-invalid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print " 3 DOMDocument::createElement(' ')\n"; -try { - $dom = new domDocument; - $dom->createElement(' '); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print " 4 DOMDocument::createElement('prefix:valid')\n"; -try { - $dom = new domDocument; - $dom->createElement('prefix:valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print " 5 DOMDocument::createElementNS('http://valid.com', 'valid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('http://valid.com', 'valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print " 6 DOMDocument::createElementNS('http://valid.com', 'prefix:valid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('http://valid.com', 'prefix:valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print " 7 DOMDocument::createElementNS('http://valid.com', '-invalid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('http://valid.com', '-invalid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print " 8 DOMDocument::createElementNS('http://valid.com', 'prefix:-invalid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('http://valid.com', 'prefix:-invalid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print " 9 DOMDocument::createElementNS('', 'prefix:invalid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('', 'prefix:invalid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "10 DOMDocument::createElementNS('http://valid.com', 'prefix:valid:invalid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('http://valid.com', 'prefix:valid:invalid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "11 DOMDocument::createElementNS('http://valid.com', '-prefix:valid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('http://valid.com', '-prefix:valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "12 DOMDocument::createElementNS('-', 'prefix:valid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('-', 'prefix:valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - - -print "13 DOMElement::__construct('valid')\n"; -try { - $element = new DomElement('valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "14 DOMElement::__construct('-invalid')\n"; -try { - $element = new DomElement('-invalid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "15 DOMElement::__construct(' ')\n"; -try { - $element = new DomElement(' '); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "16 DOMElement::__construct('prefix:valid')\n"; -try { - $element = new DomElement('prefix:valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "17 DOMElement::__construct('valid', '', 'http://valid.com')\n"; -try { - $element = new DomElement('valid', '', 'http://valid.com'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "18 DOMElement::__construct('prefix:valid', '', 'http://valid.com')\n"; -try { - $element = new DomElement('prefix:valid', '', 'http://valid.com'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "19 DOMElement::__construct('-invalid', '', 'http://valid.com')\n"; -try { - $element = new DomElement('-invalid', '', 'http://valid.com'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "20 DOMElement::__construct('prefix:-invalid', '', 'http://valid.com')\n"; -try { - $element = new DomElement('prefix:-invalid', '', 'http://valid.com'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "21 DOMElement::__construct('prefix:invalid', '', '')\n"; -try { - $element = new DomElement('prefix:invalid', '', ''); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "22 DOMElement::__construct('prefix:valid:invalid', '', 'http://valid.com')\n"; -try { - $element = new DomElement('prefix:valid:invalid', '', 'http://valid.com'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "23 DOMElement::__construct('-prefix:valid', '', 'http://valid.com')\n"; -try { - $element = new DomElement('-prefix:valid', '', 'http://valid.com'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "24 DOMElement::__construct('prefix:valid', '', '-')\n"; -try { - $element = new DomElement('prefix:valid', '', '-'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -/* the qualifiedName has a prefix and the namespaceURI is null */ - -print "25 DOMDocument::createElementNS('', 'prefix:valid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('', 'prefix:valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -/* the qualifiedName has a prefix that is "xml" and the namespaceURI - is different from "http://www.w3.org/XML/1998/namespace" [XML Namespaces] */ - -print "26 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xml:valid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('http://wrong.namespaceURI.com', 'xml:valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "27 DOMElement::__construct('xml:valid', '', 'http://wrong.namespaceURI.com')\n"; -try { - $element = new DomElement('xml:valid', '', 'http://wrong.namespaceURI.com'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -/* This is okay because we reuse the xml namespace from the document */ -print "28 DOMDocument::createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:valid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -/* This isn't because the xml namespace isn't there and we can't create it */ -print "29 DOMElement::__construct('xml:valid', '', 'http://www.w3.org/XML/1998/namespace')\n"; -try { - $element = new DomElement('xml:valid', '', 'http://www.w3.org/XML/1998/namespace'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - - -/* the qualifiedName or its prefix is "xmlns" and the namespaceURI is - different from "http://www.w3.org/2000/xmlns/" */ - -print "30 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xmlns:valid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('http://wrong.namespaceURI.com', 'xmlns:valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "31 DOMElement::__construct('xmlns:valid', '', 'http://wrong.namespaceURI.com')\n"; -try { - $element = new DomElement('xmlns:valid', '', 'http://wrong.namespaceURI.com'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "32 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:valid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "33 DOMElement::__construct('xmlns:valid', '', 'http://www.w3.org/2000/xmlns/')\n"; -try { - $element = new DomElement('xmlns:valid', '', 'http://www.w3.org/2000/xmlns/'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -/* the namespaceURI is "http://www.w3.org/2000/xmlns/" and neither the - qualifiedName nor its prefix is "xmlns". */ - -print "34 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/', 'wrongprefix:valid')\n"; -try { - $dom = new domDocument; - $dom->createElementNS('http://www.w3.org/2000/xmlns/', 'wrongprefix:valid'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - -print "35 DOMElement::__construct('wrongprefix:valid', '', 'http://www.w3.org/2000/xmlns/')\n"; -try { - $element = new DomElement('wrongprefix:valid', '', 'http://www.w3.org/2000/xmlns/'); - print "valid\n"; -} catch (Exception $e) { - print $e->getMessage() . "\n"; -} - - - -?> ---EXPECT-- - 1 DOMDocument::createElement('valid') -valid - 2 DOMDocument::createElement('-invalid') -Invalid Character Error - 3 DOMDocument::createElement(' ') -Invalid Character Error - 4 DOMDocument::createElement('prefix:valid') -valid - 5 DOMDocument::createElementNS('http://valid.com', 'valid') -valid - 6 DOMDocument::createElementNS('http://valid.com', 'prefix:valid') -valid - 7 DOMDocument::createElementNS('http://valid.com', '-invalid') -Namespace Error - 8 DOMDocument::createElementNS('http://valid.com', 'prefix:-invalid') -Namespace Error - 9 DOMDocument::createElementNS('', 'prefix:invalid') -Namespace Error -10 DOMDocument::createElementNS('http://valid.com', 'prefix:valid:invalid') -Namespace Error -11 DOMDocument::createElementNS('http://valid.com', '-prefix:valid') -Namespace Error -12 DOMDocument::createElementNS('-', 'prefix:valid') -valid -13 DOMElement::__construct('valid') -valid -14 DOMElement::__construct('-invalid') -Invalid Character Error -15 DOMElement::__construct(' ') -Invalid Character Error -16 DOMElement::__construct('prefix:valid') -Namespace Error -17 DOMElement::__construct('valid', '', 'http://valid.com') -valid -18 DOMElement::__construct('prefix:valid', '', 'http://valid.com') -valid -19 DOMElement::__construct('-invalid', '', 'http://valid.com') -Invalid Character Error -20 DOMElement::__construct('prefix:-invalid', '', 'http://valid.com') -Namespace Error -21 DOMElement::__construct('prefix:invalid', '', '') -Namespace Error -22 DOMElement::__construct('prefix:valid:invalid', '', 'http://valid.com') -Namespace Error -23 DOMElement::__construct('-prefix:valid', '', 'http://valid.com') -Invalid Character Error -24 DOMElement::__construct('prefix:valid', '', '-') -valid -25 DOMDocument::createElementNS('', 'prefix:valid') -Namespace Error -26 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xml:valid') -Namespace Error -27 DOMElement::__construct('xml:valid', '', 'http://wrong.namespaceURI.com') -Namespace Error -28 DOMDocument::createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:valid') -valid -29 DOMElement::__construct('xml:valid', '', 'http://www.w3.org/XML/1998/namespace') -Namespace Error -30 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xmlns:valid') -Namespace Error -31 DOMElement::__construct('xmlns:valid', '', 'http://wrong.namespaceURI.com') -Namespace Error -32 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:valid') -valid -33 DOMElement::__construct('xmlns:valid', '', 'http://www.w3.org/2000/xmlns/') -valid -34 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/', 'wrongprefix:valid') -Namespace Error -35 DOMElement::__construct('wrongprefix:valid', '', 'http://www.w3.org/2000/xmlns/') -Namespace Error diff --git a/ext/dom/tests/dom_import_simplexml.phpt b/ext/dom/tests/dom_import_simplexml.phpt deleted file mode 100644 index 81744aa260..0000000000 --- a/ext/dom/tests/dom_import_simplexml.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Interop Test: Import from SimpleXML ---SKIPIF-- -<?php require_once('skipif.inc'); ?> -<?php if (!extension_loaded('simplexml')) die('skip simplexml extension not available');?> ---FILE-- -<?php -$s = simplexml_load_file(dirname(__FILE__)."/book.xml"); -if(!$s) { - echo "Error while loading the document\n"; - exit; -} -$dom = dom_import_simplexml($s); -print $dom->ownerDocument->saveXML(); -?> ---EXPECT-- -<?xml version="1.0"?> -<books> - <book> - <title>The Grapes of Wrath</title> - <author>John Steinbeck</author> - </book> - <book> - <title>The Pearl</title> - <author>John Steinbeck</author> - </book> -</books> diff --git a/ext/dom/tests/dom_set_attr_node.phpt b/ext/dom/tests/dom_set_attr_node.phpt deleted file mode 100644 index 7d783c5620..0000000000 --- a/ext/dom/tests/dom_set_attr_node.phpt +++ /dev/null @@ -1,67 +0,0 @@ ---TEST-- -Test: setAttributeNode() ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php - -$xml = <<<HERE -<?xml version="1.0" ?> -<root a="b" /> -HERE; - -$xml2 = <<<HERE -<?xml version="1.0" ?> -<doc2 /> -HERE; - -$dom = new DOMDocument(); -$dom->loadXML($xml); -$root = $dom->documentElement; -$attr = $root->getAttributeNode('a'); - -$dom2 = new DOMDocument(); -$dom2->loadXML($xml2); -$root2 = $dom2->documentElement; -try { - $root2->setAttributeNode($attr); -} catch (domexception $e) { - var_dump($e); -} - -?> ---EXPECTF-- -object(DOMException)#%d (6) { - ["message:protected"]=> - string(20) "Wrong Document Error" - ["string:private"]=> - string(0) "" - ["file:protected"]=> - string(%d) "%sdom_set_attr_node.php" - ["line:protected"]=> - int(%d) - ["trace:private"]=> - array(1) { - [0]=> - array(6) { - ["file"]=> - string(%d) "%sdom_set_attr_node.php" - ["line"]=> - int(%d) - ["function"]=> - string(16) "setAttributeNode" - ["class"]=> - string(10) "DOMElement" - ["type"]=> - string(2) "->" - ["args"]=> - array(1) { - [0]=> - object(DOMAttr)#%d (0) { - } - } - } - } - ["code"]=> - int(4) -} diff --git a/ext/dom/tests/dom_test.inc b/ext/dom/tests/dom_test.inc deleted file mode 100644 index 86b426f8f3..0000000000 --- a/ext/dom/tests/dom_test.inc +++ /dev/null @@ -1,47 +0,0 @@ -<?PHP -$xmlstr = "<?xml version='1.0' standalone='yes'?> -<!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd' -[ <!ENTITY sp \"spanish\"> -]> -<!-- lsfj --> -<chapter language='en'><title language='en'>Title</title> -<para language='ge'> -&sp; -<!-- comment --> -<informaltable language='&sp;kkk'> -<tgroup cols='3'> -<tbody> -<row><entry>a1</entry><entry morerows='1'>b1</entry><entry>c1</entry></row> -<row><entry>a2</entry><entry>c2</entry></row> -<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row> -</tbody> -</tgroup> -</informaltable> -</para> -</chapter> "; - -function print_node($node) -{ - print "Node Name: " . $node->nodeName; - print "\nNode Type: " . $node->nodeType; - if ($node->nodeType != 3) { - $child_count = $node->childNodes->length; - } else { - $child_count = 0; - } - print "\nNum Children: " . $child_count; - if($child_count <= 1){ - print "\nNode Content: " . $node->nodeValue; - } - print "\n\n"; -} - -function print_node_list($nodelist) -{ - foreach($nodelist as $node) - { - print_node($node); - } -} - -?> diff --git a/ext/dom/tests/dom_xinclude.phpt b/ext/dom/tests/dom_xinclude.phpt deleted file mode 100644 index f9a3dd761e..0000000000 --- a/ext/dom/tests/dom_xinclude.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -Test: Xinclude and Streams ---SKIPIF-- -<?php -require_once('skipif.inc'); -array_search('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrapper is not available'); -?> ---FILE-- -<?php -$dom = new domdocument; - -$data = file_get_contents(dirname(__FILE__)."/xinclude.xml"); -$data = str_replace('compress.zlib://ext/dom/tests/','compress.zlib://'.dirname(__FILE__).'/', $data); - -$dom->loadXML($data); - -$dom->xinclude(); -print $dom->saveXML()."\n"; -foreach ($dom->documentElement->childNodes as $node) { - print $node->nodeName."\n"; -} -?> ---EXPECTF-- -<?xml version="1.0"?> -<foo xmlns:xi="http://www.w3.org/2001/XInclude"> - <book xml:base="compress.zlib://%sext/dom/tests/book.xml"> - <title>The Grapes of Wrath</title> - <author>John Steinbeck</author> - </book><book xml:base="compress.zlib://%sext/dom/tests/book.xml"> - <title>The Pearl</title> - <author>John Steinbeck</author> - </book> - </foo> - -#text -book -book -#text diff --git a/ext/dom/tests/domattributes.phpt b/ext/dom/tests/domattributes.phpt deleted file mode 100644 index 9097a887e9..0000000000 --- a/ext/dom/tests/domattributes.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -Attributes: DOMAttribute functionality ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require_once("dom_test.inc"); - -$dom = new DOMDocument; -$dom->loadXML($xmlstr); -if(!$dom) { - echo "Error while parsing the document\n"; - exit; -} - -$node = $dom->documentElement; - -$lang = $node->getAttributeNode('language'); -echo "Language: ".$lang->value."\n"; - -$lang->value = 'en-US'; -echo "Language: ".$lang->value."\n"; - -$parent = $lang->ownerElement; - -$chapter = new DOMAttr("num", "1"); -$parent->setAttributeNode($chapter); - -echo "Is ID?: ".($chapter->isId()?'YES':'NO')."\n"; - -$top_element = $node->cloneNode(); - -print $dom->saveXML($top_element); - - -?> ---EXPECT-- - -Language: en -Language: en-US -Is ID?: NO -<chapter language="en-US" num="1"/> - diff --git a/ext/dom/tests/domchardata.phpt b/ext/dom/tests/domchardata.phpt deleted file mode 100644 index 6baff6d148..0000000000 --- a/ext/dom/tests/domchardata.phpt +++ /dev/null @@ -1,76 +0,0 @@ ---TEST-- -CharData: DOMCharacterData and related functionality ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require_once("dom_test.inc"); - -$dom = new DOMDocument; -$dom->loadXML($xmlstr); -if(!$dom) { - echo "Error while parsing the document\n"; - exit; -} - -$node = $dom->documentElement; - -$charnode = $dom->createElement('charnode'); -$node->appendChild($charnode); - -/* DOMComment */ -$comment = new DOMComment('Testing character data and extending nodes'); -$charnode->appendChild($comment); - -echo "Comment Length: ".$comment->length."\n"; - -$comment->data = 'Updated comment'; -echo "New Comment Length: ".$comment->length."\n"; -echo "New Comment Data: ".$comment->data."\n"; - -/* DOMCDataSection */ -$cdata = new DOMCDataSection('Chars: <>&"'); -$charnode->appendChild($cdata); - -echo "Substring: ".$cdata->substringData(7, 4)."\n"; -$cdata->replaceData(10, 1, "'"); -echo "New Substring: ".$cdata->substringData(7, 4)."\n"; - -/* DOMCharacterData using DOMComment */ -$comment = new DOMComment('instructions'); -echo "Comment Value: ".$comment->data."\n"; -$comment->data = 'some more instructions'; -echo "New Comment Value: ".$comment->data."\n"; - -$comment->insertData(10, 'pi '); -$comment->replaceData(18, 5, 'i'); -$comment->insertData(20, 'g'); -$comment->deleteData(13, 2); -$comment->deleteData(10, 3); -$comment->insertData(10, 'comment '); -echo "Updated Comment Value: ".$comment->data."\n"; - -/* DOMText */ -$text = new DOMText('some text characters'); - -echo "Whole Text: ".$text->wholeText."\n"; -$text2 = $text->splitText(9); - -echo "Split text: ".$text2->wholeText."\n"; -$text3 = $text2->splitText(1); - -echo "Is Whitespace?: ".($text2->isElementContentWhitespace()?'YES':'NO'); -?> ---EXPECT-- - -Comment Length: 42 -New Comment Length: 15 -New Comment Data: Updated comment -Substring: <>&" -New Substring: <>&' -Comment Value: instructions -New Comment Value: some more instructions -Updated Comment Value: some more comment strings -Whole Text: some text characters -Split text: characters -Is Whitespace?: YES diff --git a/ext/dom/tests/domelement.phpt b/ext/dom/tests/domelement.phpt deleted file mode 100644 index bc69af602c..0000000000 --- a/ext/dom/tests/domelement.phpt +++ /dev/null @@ -1,114 +0,0 @@ ---TEST-- -Elements: DOMElement functionality ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require_once("dom_test.inc"); - -$dom = new DOMDocument; -$dom->loadXML($xmlstr); -if(!$dom) { - echo "Error while parsing the document\n"; - exit; -} - -$node = $dom->documentElement; -echo "Tag Name: ".$node->tagName."\n"; - - -$node->setAttribute('num', '1'); -echo "Chapter: ".$node->getAttribute('num')."\n"; -echo 'Attribute num exists?: '.($node->hasAttribute('num')?'Yes':'No')."\n"; -$node->removeAttribute('num'); -echo "Chapter: ".$node->getAttribute('num')."\n"; -echo 'Attribute num exists?: '.($node->hasAttribute('num')?'Yes':'No')."\n"; - -echo "Language: ".$node->getAttribute('language')."\n"; -$lang = $node->getAttributeNode('language'); -$lang->nodeValue = 'en-US'; -$node->setAttributeNode($lang); -echo "Language: ".$node->getAttribute('language')."\n"; -$node->removeAttributeNode($lang); -echo "Language: ".$node->getAttribute('language')."\n"; - -echo "\n-- xml:lang --\n"; -$node->setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:lang', 'en'); -echo "Language: ".$node->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')."\n"; -echo 'Attribute xml:lang exists?: '.($node->hasAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')?'Yes':'No')."\n"; - -$node->removeAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang'); -echo "Language: ".$node->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')."\n"; -echo 'Attribute xml:lang exists?: '.($node->hasAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')?'Yes':'No')."\n"; - -$lang = $dom->createAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:lang'); -$lang->nodeValue = 'en-GB'; -$node->setAttributeNodeNS($lang); -unset($lang); -echo "Language: ".$node->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')."\n"; -$lang = $node->getAttributeNodeNS('http://www.w3.org/XML/1998/namespace', 'lang'); -echo "Language: ".$lang->value."\n"; - -echo "\n-- Elements --\n"; -$rows = $node->getElementsByTagName('row'); -echo "Row Count: ".$rows->length."\n"; - -$element_ns = new DOMElement('newns:myelement', 'default content', 'urn::dummyns'); -$node->appendChild($element_ns); -$element_ns = new DOMElement('newns2:myelement', 'second default content', 'urn::dummyns'); -$node->appendChild($element_ns); - -$myelements = $node->getElementsByTagNameNS('urn::dummyns', 'myelement'); -$mylen = $myelements->length; -echo "myelements Count: ".$mylen."\n"; - -echo "\n-- IDs --\n"; -$node->setAttribute('idatt', 'n1'); -$node->setIdAttribute('idatt', TRUE); - -for ($x = 0; $x < $mylen; $x++) { - $current = $myelements->item($x); - $current->setAttributeNS('urn::dummyns', 'newns:idatt', 'n'.($x+2))."\n"; - $current->setIdAttributeNS('urn::dummyns', 'idatt', TRUE); -} - -echo 'Element Name: '.(($elem = $dom->getElementByID('n1'))?$elem->localName:'Not Found')."\n"; -$idatt = $node->getAttributeNode('idatt'); -$node->setIdAttributeNode($idatt, FALSE); -echo 'Element Name: '.(($elem = $dom->getElementByID('n1'))?$elem->localName:'Not Found')."\n"; - -echo 'Element Name: '.(($elem = $dom->getElementByID('n3'))?$elem->nodeName:'Not Found')."\n"; -for ($x = 0; $x < $mylen; $x++) { - $node = $myelements->item($x); - $node->setIdAttributeNS('urn::dummyns', 'idatt', FALSE); -} -echo 'Element Name: '.(($elem = $dom->getElementByID('n3'))?$elem->nodeName:'Not Found')."\n"; -?> ---EXPECT-- - -Tag Name: chapter -Chapter: 1 -Attribute num exists?: Yes -Chapter: -Attribute num exists?: No -Language: en -Language: en-US -Language: - --- xml:lang -- -Language: en -Attribute xml:lang exists?: Yes -Language: -Attribute xml:lang exists?: No -Language: en-GB -Language: en-GB - --- Elements -- -Row Count: 3 -myelements Count: 2 - --- IDs -- -Element Name: chapter -Element Name: Not Found -Element Name: newns2:myelement -Element Name: Not Found diff --git a/ext/dom/tests/nsdoc.xml b/ext/dom/tests/nsdoc.xml deleted file mode 100644 index 9503fd8c5b..0000000000 --- a/ext/dom/tests/nsdoc.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0"?> -<root xmlns="http://ns" xmlns:ns2="http://ns2"> - <ns2:child /> -</root>
\ No newline at end of file diff --git a/ext/dom/tests/regsiter_node_class.phpt b/ext/dom/tests/regsiter_node_class.phpt deleted file mode 100644 index 5444cc4b9e..0000000000 --- a/ext/dom/tests/regsiter_node_class.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -Test: registerNodeClass() ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -class myAttribute extends DOMAttr { - function testit() { return "HELLO Attribute"; } -} - -class myElement extends DOMElement { - function testit() { return "HELLO Element"; } -} - -$doc = new DOMDocument(); -$doc->registerNodeClass('DOMAttr', 'myAttribute'); -$doc->registerNodeClass('DOMElement', 'myElement'); -$doc->appendChild(new DOMElement('root')); -$root = $doc->documentElement; -$root->setAttribute('a', 'a1'); -var_dump($root); -print $root->testit()."\n"; -$attr = $root->getAttributeNode('a'); -var_dump($attr); -print $attr->testit()."\n"; -unset($attr); -$doc->registerNodeClass('DOMAttr', NULL); -$attr = $root->getAttributeNode('a'); -var_dump($attr); -print $attr->testit()."\n"; -?> ---EXPECTF-- - -object(myElement)#%d (0) { -} -HELLO Element -object(myAttribute)#%d (0) { -} -HELLO Attribute -object(DOMAttr)#%d (0) { -} - -Fatal error: Call to undefined method DOMAttr::testit() in %s on line 25 diff --git a/ext/dom/tests/skipif.inc b/ext/dom/tests/skipif.inc deleted file mode 100644 index 08fd695d97..0000000000 --- a/ext/dom/tests/skipif.inc +++ /dev/null @@ -1 +0,0 @@ -<?php if (!extension_loaded('dom')) die('skip dom extension not available');?>
\ No newline at end of file diff --git a/ext/dom/tests/test.html b/ext/dom/tests/test.html deleted file mode 100644 index fe6d0d3dbc..0000000000 --- a/ext/dom/tests/test.html +++ /dev/null @@ -1,9 +0,0 @@ -<html> -<head> -<title>Hello world</title> -</head> -<body> -This is a not well-formed<br> -html files with undeclared entities -</body> -</html> diff --git a/ext/dom/tests/xinclude.xml b/ext/dom/tests/xinclude.xml deleted file mode 100644 index 27efa91aee..0000000000 --- a/ext/dom/tests/xinclude.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0"?> -<foo xmlns:xi="http://www.w3.org/2001/XInclude"> - <xi:include href="compress.zlib://ext/dom/tests/book.xml#xpointer(/books/book)"/> - </foo> |