]> granicus.if.org Git - php/commitdiff
finish the cleaning. also add a new test
authorNuno Lopes <nlopess@php.net>
Tue, 5 Sep 2006 14:55:56 +0000 (14:55 +0000)
committerNuno Lopes <nlopess@php.net>
Tue, 5 Sep 2006 14:55:56 +0000 (14:55 +0000)
ext/tidy/tests/020.phpt [new file with mode: 0644]
ext/tidy/tidy.c

diff --git a/ext/tidy/tests/020.phpt b/ext/tidy/tests/020.phpt
new file mode 100644 (file)
index 0000000..e7ee4b3
--- /dev/null
@@ -0,0 +1,49 @@
+--TEST--
+tidy and tidyNode OO
+--SKIPIF--
+<?php if (!extension_loaded('tidy')) echo 'skip'; ?>
+--FILE--
+<?php
+
+//test leaks here:
+new tidyNode();
+var_dump(new tidyNode());
+new tidy();
+var_dump(new tidy());
+
+echo "-------\n";
+
+$x = new tidyNode();
+var_dump($x->isHtml());
+
+$tidy = new tidy();
+$tidy->parseString('<html><?php echo "xpto;" ?></html>');
+
+var_dump(tidy_get_root($tidy)->child[0]->isHtml());
+var_dump(tidy_get_root($tidy)->child[0]->child[0]->isPHP());
+var_dump(tidy_get_root($tidy)->child[0]->child[0]->isAsp());
+var_dump(tidy_get_root($tidy)->child[0]->child[0]->isJste());
+var_dump(tidy_get_root($tidy)->child[0]->child[0]->type === TIDY_NODETYPE_PHP);
+
+var_dump(tidy_get_root($tidy)->child[0]->hasChildren());
+var_dump(tidy_get_root($tidy)->child[0]->child[0]->hasChildren());
+
+?>
+--EXPECT--
+object(tidyNode)#1 (0) {
+}
+object(tidy)#1 (2) {
+  ["errorBuffer"]=>
+  NULL
+  ["value"]=>
+  NULL
+}
+-------
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
index 4c5bf49f57fbf3a8e7f4fb7d11dcd9aee9db1d10..4de0bbf347ae5a0e241866b4f7f5e84eaa82f6b6 100644 (file)
@@ -31,9 +31,6 @@
 #include "ext/standard/info.h"
 #include "safe_mode.h"
 
-#include "Zend/zend_exceptions.h"
-#include "Zend/zend_object_handlers.h"
-
 #include "tidy.h"
 #include "buffio.h"
 
@@ -276,13 +273,10 @@ static TIDY_DOC_METHOD(__construct);
 static TIDY_DOC_METHOD(parseFile);
 static TIDY_DOC_METHOD(parseString);
 
-static TIDY_NODE_METHOD(__construct);
 static TIDY_NODE_METHOD(hasChildren);
 static TIDY_NODE_METHOD(hasSiblings);
 static TIDY_NODE_METHOD(isComment);
 static TIDY_NODE_METHOD(isHtml);
-static TIDY_NODE_METHOD(isXhtml);
-static TIDY_NODE_METHOD(isXml);
 static TIDY_NODE_METHOD(isText);
 static TIDY_NODE_METHOD(isJste);
 static TIDY_NODE_METHOD(isAsp);
@@ -353,7 +347,6 @@ static zend_function_entry tidy_funcs_doc[] = {
 };
 
 static zend_function_entry tidy_funcs_node[] = {
-       TIDY_NODE_ME(__construct, NULL)
        TIDY_NODE_ME(hasChildren, NULL)
        TIDY_NODE_ME(hasSiblings, NULL)
        TIDY_NODE_ME(isComment, NULL)
@@ -1601,13 +1594,6 @@ static PHP_FUNCTION(tidy_get_body)
 }
 /* }}} */
 
-/* {{{ proto tidyNode::tidyNode()
-   Constructor. */
-static TIDY_NODE_METHOD(__construct)
-{      
-}
-/* }}} */
-
 /* {{{ proto boolean tidyNode::hasChildren()
    Returns true if this node has children */
 static TIDY_NODE_METHOD(hasChildren)