summaryrefslogtreecommitdiff
path: root/ext/tidy/tests
diff options
context:
space:
mode:
authorNuno Lopes <nlopess@php.net>2007-01-20 12:50:19 +0000
committerNuno Lopes <nlopess@php.net>2007-01-20 12:50:19 +0000
commit65975bfc15a5acea12ee6ddb86ab3482c2279d04 (patch)
tree31db97a5d14f63dda24aabb9c4415e3145aba003 /ext/tidy/tests
parent4b8911d062af56bdf4b2a120d450e9ca6aefe8ee (diff)
downloadphp-git-65975bfc15a5acea12ee6ddb86ab3482c2279d04.tar.gz
new tests. bump code coverage to 81%
Diffstat (limited to 'ext/tidy/tests')
-rw-r--r--ext/tidy/tests/024.phpt41
-rw-r--r--ext/tidy/tests/025.phpt50
-rw-r--r--ext/tidy/tests/026.phpt24
3 files changed, 115 insertions, 0 deletions
diff --git a/ext/tidy/tests/024.phpt b/ext/tidy/tests/024.phpt
new file mode 100644
index 0000000000..c3d08cd6ea
--- /dev/null
+++ b/ext/tidy/tests/024.phpt
@@ -0,0 +1,41 @@
+--TEST--
+libtidy handling of 'new-blocklevel-tags'
+--SKIPIF--
+<?php
+if (!extension_loaded('tidy')) die('skip');
+if (strtotime(tidy_get_release()) < strtotime('20 january 2007')) die ('skip old libtidy');
+?>
+--FILE--
+<?php
+
+// more info at http://sf.net/tracker/?func=detail&atid=390963&aid=1598422&group_id=27659
+
+$contents = '
+<wps:block>
+<wps:var>
+<wps:value/>
+</wps:var>
+</wps:block>';
+
+$config = array(
+'new-blocklevel-tags' => 'wps:block,wps:var,wps:value'
+);
+
+$tidy = tidy_parse_string($contents, $config, 'utf8');
+$tidy->cleanRepair();
+
+var_dump($tidy->value);
+
+?>
+--EXPECT--
+string(117) "<html>
+<head>
+<title></title>
+</head>
+<body>
+<wps:block>
+<wps:var>
+<wps:value></wps:var>
+</wps:block>
+</body>
+</html>"
diff --git a/ext/tidy/tests/025.phpt b/ext/tidy/tests/025.phpt
new file mode 100644
index 0000000000..a7bd544d67
--- /dev/null
+++ b/ext/tidy/tests/025.phpt
@@ -0,0 +1,50 @@
+--TEST--
+tidyNode tests
+--SKIPIF--
+<?php if (!extension_loaded('tidy')) die('skip'); ?>
+--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());
+
+$tidy=tidy_parse_string('<# #>');
+var_dump($tidy->Root()->child[0]->isJste());
+
+$tidy=tidy_parse_string('<html><body>text</body></html>');
+var_dump($tidy->Root()->child[0]->child[1]->child[0]->isText());
+
+$tidy=tidy_parse_string('<html><body><!-- comment --></body></html>');
+$n = $tidy->Root()->child[0]->child[1]->child[0];
+var_dump($n->isComment());
+var_dump((string)$n);
+var_dump((bool)$n);
+var_dump((double)$n);
+var_dump((int)$n);
+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)
+bool(true)
+string(16) "<!-- comment -->"
+bool(true)
+float(0)
+int(0)
+bool(true)
diff --git a/ext/tidy/tests/026.phpt b/ext/tidy/tests/026.phpt
new file mode 100644
index 0000000000..24a1e6f4a7
--- /dev/null
+++ b/ext/tidy/tests/026.phpt
@@ -0,0 +1,24 @@
+--TEST--
+tidy.clean_output test
+--SKIPIF--
+<?php if (!extension_loaded('tidy')) die('skip'); ?>
+--INI--
+tidy.clean_output=1
+--FILE--
+<html>
+<?php
+
+echo '<p>xpto</p>';
+
+?>
+</html>
+--EXPECT--
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+<head>
+<title></title>
+</head>
+<body>
+<p>xpto</p>
+</body>
+</html>