summaryrefslogtreecommitdiff
path: root/ext/tidy/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tidy/tests')
-rw-r--r--ext/tidy/tests/023.phpt8
-rw-r--r--ext/tidy/tests/025.phpt14
-rw-r--r--ext/tidy/tests/035.phpt12
-rw-r--r--ext/tidy/tests/bug_50558.phpt28
4 files changed, 40 insertions, 22 deletions
diff --git a/ext/tidy/tests/023.phpt b/ext/tidy/tests/023.phpt
index e7ee4b3c0..1f7b02d56 100644
--- a/ext/tidy/tests/023.phpt
+++ b/ext/tidy/tests/023.phpt
@@ -6,16 +6,11 @@ tidy and tidyNode OO
<?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>');
@@ -30,8 +25,6 @@ var_dump(tidy_get_root($tidy)->child[0]->child[0]->hasChildren());
?>
--EXPECT--
-object(tidyNode)#1 (0) {
-}
object(tidy)#1 (2) {
["errorBuffer"]=>
NULL
@@ -39,7 +32,6 @@ object(tidy)#1 (2) {
NULL
}
-------
-bool(false)
bool(true)
bool(true)
bool(false)
diff --git a/ext/tidy/tests/025.phpt b/ext/tidy/tests/025.phpt
index a7bd544d6..631ec2e5e 100644
--- a/ext/tidy/tests/025.phpt
+++ b/ext/tidy/tests/025.phpt
@@ -5,15 +5,6 @@ tidyNode tests
--FILE--
<?php
-new tidyNode;
-$node = new tidyNode();
-
-var_dump($node->isPhp());
-var_dump($node->isText());
-var_dump($node->isComment());
-var_dump($node->hasSiblings());
-var_dump((string)$node);
-
$tidy=tidy_parse_string('<% %>');
var_dump($tidy->Root()->child[0]->isAsp());
@@ -34,11 +25,6 @@ var_dump($tidy->Root()->child[0]->child[0]->hasSiblings());
?>
--EXPECT--
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-string(0) ""
bool(true)
bool(true)
bool(true)
diff --git a/ext/tidy/tests/035.phpt b/ext/tidy/tests/035.phpt
new file mode 100644
index 000000000..832f90fe5
--- /dev/null
+++ b/ext/tidy/tests/035.phpt
@@ -0,0 +1,12 @@
+--TEST--
+tidyNode::__construct()
+--SKIPIF--
+<?php
+ if (!extension_loaded('tidy')) die ('skip tidy not present');
+?>
+--FILE--
+<?php
+new tidyNode;
+?>
+--EXPECTF--
+Fatal error: Call to private tidyNode::__construct() from invalid context in %s on line %d
diff --git a/ext/tidy/tests/bug_50558.phpt b/ext/tidy/tests/bug_50558.phpt
new file mode 100644
index 000000000..b37cb9219
--- /dev/null
+++ b/ext/tidy/tests/bug_50558.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #50558 - Broken object model when extending tidy
+--SKIPIF--
+<?php if (!extension_loaded("tidy")) print "skip"; ?>
+--FILE--
+<?php
+class MyTidy extends tidy
+{
+ // foo
+}
+
+function doSomething(MyTidy $o)
+{
+ var_dump($o);
+}
+
+$o = new MyTidy();
+var_dump($o instanceof MyTidy);
+doSomething($o);
+?>
+--EXPECTF--
+bool(true)
+object(MyTidy)#%d (%d) {
+ ["errorBuffer"]=>
+ NULL
+ ["value"]=>
+ NULL
+}