]> granicus.if.org Git - php/commitdiff
new tests. bump code coverage to 81%
authorNuno Lopes <nlopess@php.net>
Sat, 20 Jan 2007 12:50:19 +0000 (12:50 +0000)
committerNuno Lopes <nlopess@php.net>
Sat, 20 Jan 2007 12:50:19 +0000 (12:50 +0000)
ext/tidy/tests/024.phpt [new file with mode: 0644]
ext/tidy/tests/025.phpt [new file with mode: 0644]
ext/tidy/tests/026.phpt [new file with mode: 0644]

diff --git a/ext/tidy/tests/024.phpt b/ext/tidy/tests/024.phpt
new file mode 100644 (file)
index 0000000..c3d08cd
--- /dev/null
@@ -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 (file)
index 0000000..a7bd544
--- /dev/null
@@ -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 (file)
index 0000000..24a1e6f
--- /dev/null
@@ -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>