summaryrefslogtreecommitdiff
path: root/ext/dom/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom/tests')
-rw-r--r--ext/dom/tests/book.xml11
-rw-r--r--ext/dom/tests/book.xml.gzbin119 -> 0 bytes
-rw-r--r--ext/dom/tests/dom001.phpt275
-rw-r--r--ext/dom/tests/dom002.phpt57
-rw-r--r--ext/dom/tests/dom003.phpt33
-rw-r--r--ext/dom/tests/dom004.phpt25
-rw-r--r--ext/dom/tests/dom005.phpt36
-rw-r--r--ext/dom/tests/dom006.phpt46
-rw-r--r--ext/dom/tests/dom_import_simplexml.phpt27
-rw-r--r--ext/dom/tests/dom_test.inc47
-rw-r--r--ext/dom/tests/dom_xinclude.phpt33
-rw-r--r--ext/dom/tests/skipif.inc1
-rw-r--r--ext/dom/tests/test.html9
-rw-r--r--ext/dom/tests/xinclude.xml4
14 files changed, 0 insertions, 604 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
deleted file mode 100644
index 2c97807a59..0000000000
--- a/ext/dom/tests/book.xml.gz
+++ /dev/null
Binary files differ
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 2bc0717d64..0000000000
--- a/ext/dom/tests/dom002.phpt
+++ /dev/null
@@ -1,57 +0,0 @@
---TEST--
-Test 2: getElementsByTagName() / getElementsByTagNameNS()
---SKIPIF--
-<?php require_once('skipif.php'); ?>
---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 40ddb1f775..0000000000
--- a/ext/dom/tests/dom003.phpt
+++ /dev/null
@@ -1,33 +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) {
- ["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 {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 7f36eb3692..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()) || 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 ff8a79a5ff..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("DOCTYPE HTML","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><p>
-This is a not well-formed<br/>
-html files with undeclared entities 
-</p></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><p>
-This is a not well-formed<br>
-html files with undeclared entities&nbsp;
-</p></body>
-</html>
diff --git a/ext/dom/tests/dom006.phpt b/ext/dom/tests/dom006.phpt
deleted file mode 100644
index 7f393003d5..0000000000
--- a/ext/dom/tests/dom006.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test 6: Extends Test
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-
-Class books extends domDocument {
- function __construct() {
- /* We must first call the constructor for the parent to create the document
- otherwise this class will not work */
- parent::__construct();
- }
-
- 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/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_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 859dd54583..0000000000
--- a/ext/dom/tests/dom_xinclude.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Test: Xinclude and Streams
---SKIPIF--
-<?php
-require_once('skipif.inc');
-array_search('compress.zlib', stream_get_wrappers()) || die('skip compress.zlib wrapper is not available');
-?>
---FILE--
-<?php
-$dom = new domdocument;
-$dom->load(dirname(__FILE__)."/xinclude.xml");
-$dom->xinclude();
-print $dom->saveXML()."\n";
-foreach ($dom->documentElement->childNodes as $node) {
- print $node->nodeName."\n";
-}
-
---EXPECT--
-<?xml version="1.0"?>
-<foo xmlns:xi="http://www.w3.org/2001/XInclude">
- <book xml:base="compress.zlib://ext/dom/tests/book.xml">
- <title>The Grapes of Wrath</title>
- <author>John Steinbeck</author>
- </book><book xml:base="compress.zlib://ext/dom/tests/book.xml">
- <title>The Pearl</title>
- <author>John Steinbeck</author>
- </book>
- </foo>
-
-#text
-book
-book
-#text
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&nbsp;
-</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>