--- /dev/null
+--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)
#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"
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);
};
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)
}
/* }}} */
-/* {{{ 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)