summaryrefslogtreecommitdiff
path: root/ext/tidy/tests/013.phpt
diff options
context:
space:
mode:
authorJohn Coggeshall <john@php.net>2004-01-14 02:43:33 +0000
committerJohn Coggeshall <john@php.net>2004-01-14 02:43:33 +0000
commit604890702933a37814b379b0a947bb092e837b3e (patch)
treea33e061a946db1595a3743d65a60ab4e0589485c /ext/tidy/tests/013.phpt
parentbc9cbe271565af7eb1ad4ad30125bb68a43a8b24 (diff)
downloadphp-git-604890702933a37814b379b0a947bb092e837b3e.tar.gz
With the approval of Andi, changing the Tidy API to reduce the possible
amount of confusion when setting Tidy configuration options. All configuration must now be done pre-parsing of the document. Removed references to the tidy_attr class, as it is no longer used (since tidy 2.0) and made tidy throw exceptions for all truly non-fatal errors.
Diffstat (limited to 'ext/tidy/tests/013.phpt')
-rw-r--r--ext/tidy/tests/013.phpt346
1 files changed, 6 insertions, 340 deletions
diff --git a/ext/tidy/tests/013.phpt b/ext/tidy/tests/013.phpt
index 013cb1fd0d..5db0ce1cd8 100644
--- a/ext/tidy/tests/013.phpt
+++ b/ext/tidy/tests/013.phpt
@@ -1,350 +1,16 @@
--TEST--
-Accessing children nodes
+Parsing a file using constructor
--SKIPIF--
-<?php if (!extension_loaded("tidy") || !class_exists("tidy_doc")) print "skip"; ?>
+<?php if (!extension_loaded("tidy")) print "skip"; ?>
--POST--
--GET--
--INI--
--FILE--
<?php
+ $tidy = new tidy("ext/tidy/tests/013.html", array("show-body-only"=>true));
+ $tidy->clean_repair();
+ echo $tidy;
- function dump_nodes(tidy_node $node) {
-
- var_dump($node->has_children());
- if($node->has_children()) {
-
- foreach($node->child as $c) {
-
- var_dump($c);
-
- if($c->has_children()) {
-
- dump_nodes($c);
-
- }
- }
-
- }
-
- }
-
- $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000><B>Hi</B><I>Bye<U>Test</U></I></BODY></HTML>");
- $html = $a->html();
- dump_nodes($html);
-
?>
--EXPECT--
-bool(true)
-object(tidy_node)#3 (6) {
- ["value"]=>
- string(31) "<head>
-<title></title>
-</head>
-"
- ["name"]=>
- string(4) "head"
- ["type"]=>
- int(5)
- ["id"]=>
- int(46)
- ["attribute"]=>
- NULL
- ["child"]=>
- array(1) {
- [0]=>
- &object(tidy_node)#4 (6) {
- ["value"]=>
- string(16) "<title></title>
-"
- ["name"]=>
- string(5) "title"
- ["type"]=>
- int(5)
- ["id"]=>
- int(111)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
- }
- }
-}
-bool(true)
-object(tidy_node)#4 (6) {
- ["value"]=>
- string(16) "<title></title>
-"
- ["name"]=>
- string(5) "title"
- ["type"]=>
- int(5)
- ["id"]=>
- int(111)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
-}
-object(tidy_node)#5 (6) {
- ["value"]=>
- string(80) "<body bgcolor="#FFFFFF" alink="#000000">
-<b>Hi</b><i>Bye<u>Test</u></i>
-</body>
-"
- ["name"]=>
- string(4) "body"
- ["type"]=>
- int(5)
- ["id"]=>
- int(16)
- ["attribute"]=>
- array(2) {
- ["bgcolor"]=>
- string(7) "#FFFFFF"
- ["alink"]=>
- string(7) "#000000"
- }
- ["child"]=>
- array(2) {
- [0]=>
- &object(tidy_node)#6 (6) {
- ["value"]=>
- string(9) "<b>Hi</b>"
- ["name"]=>
- string(1) "b"
- ["type"]=>
- int(5)
- ["id"]=>
- int(8)
- ["attribute"]=>
- NULL
- ["child"]=>
- array(1) {
- [0]=>
- &object(tidy_node)#7 (5) {
- ["value"]=>
- string(2) "Hi"
- ["name"]=>
- string(0) ""
- ["type"]=>
- int(4)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
- }
- }
- }
- [1]=>
- &object(tidy_node)#8 (6) {
- ["value"]=>
- string(21) "<i>Bye<u>Test</u></i>"
- ["name"]=>
- string(1) "i"
- ["type"]=>
- int(5)
- ["id"]=>
- int(49)
- ["attribute"]=>
- NULL
- ["child"]=>
- array(2) {
- [0]=>
- &object(tidy_node)#9 (5) {
- ["value"]=>
- string(3) "Bye"
- ["name"]=>
- string(0) ""
- ["type"]=>
- int(4)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
- }
- [1]=>
- &object(tidy_node)#10 (6) {
- ["value"]=>
- string(11) "<u>Test</u>"
- ["name"]=>
- string(1) "u"
- ["type"]=>
- int(5)
- ["id"]=>
- int(114)
- ["attribute"]=>
- NULL
- ["child"]=>
- array(1) {
- [0]=>
- &object(tidy_node)#11 (5) {
- ["value"]=>
- string(4) "Test"
- ["name"]=>
- string(0) ""
- ["type"]=>
- int(4)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
- }
- }
- }
- }
- }
- }
-}
-bool(true)
-object(tidy_node)#6 (6) {
- ["value"]=>
- string(9) "<b>Hi</b>"
- ["name"]=>
- string(1) "b"
- ["type"]=>
- int(5)
- ["id"]=>
- int(8)
- ["attribute"]=>
- NULL
- ["child"]=>
- array(1) {
- [0]=>
- &object(tidy_node)#7 (5) {
- ["value"]=>
- string(2) "Hi"
- ["name"]=>
- string(0) ""
- ["type"]=>
- int(4)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
- }
- }
-}
-bool(true)
-object(tidy_node)#7 (5) {
- ["value"]=>
- string(2) "Hi"
- ["name"]=>
- string(0) ""
- ["type"]=>
- int(4)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
-}
-object(tidy_node)#8 (6) {
- ["value"]=>
- string(21) "<i>Bye<u>Test</u></i>"
- ["name"]=>
- string(1) "i"
- ["type"]=>
- int(5)
- ["id"]=>
- int(49)
- ["attribute"]=>
- NULL
- ["child"]=>
- array(2) {
- [0]=>
- &object(tidy_node)#9 (5) {
- ["value"]=>
- string(3) "Bye"
- ["name"]=>
- string(0) ""
- ["type"]=>
- int(4)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
- }
- [1]=>
- &object(tidy_node)#10 (6) {
- ["value"]=>
- string(11) "<u>Test</u>"
- ["name"]=>
- string(1) "u"
- ["type"]=>
- int(5)
- ["id"]=>
- int(114)
- ["attribute"]=>
- NULL
- ["child"]=>
- array(1) {
- [0]=>
- &object(tidy_node)#11 (5) {
- ["value"]=>
- string(4) "Test"
- ["name"]=>
- string(0) ""
- ["type"]=>
- int(4)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
- }
- }
- }
- }
-}
-bool(true)
-object(tidy_node)#9 (5) {
- ["value"]=>
- string(3) "Bye"
- ["name"]=>
- string(0) ""
- ["type"]=>
- int(4)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
-}
-object(tidy_node)#10 (6) {
- ["value"]=>
- string(11) "<u>Test</u>"
- ["name"]=>
- string(1) "u"
- ["type"]=>
- int(5)
- ["id"]=>
- int(114)
- ["attribute"]=>
- NULL
- ["child"]=>
- array(1) {
- [0]=>
- &object(tidy_node)#11 (5) {
- ["value"]=>
- string(4) "Test"
- ["name"]=>
- string(0) ""
- ["type"]=>
- int(4)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
- }
- }
-}
-bool(true)
-object(tidy_node)#11 (5) {
- ["value"]=>
- string(4) "Test"
- ["name"]=>
- string(0) ""
- ["type"]=>
- int(4)
- ["attribute"]=>
- NULL
- ["child"]=>
- NULL
-}
+<b>testing</b> \ No newline at end of file