nlopess Tue Sep 5 15:23:26 2006 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/tidy/tests 021.phpt 022.phpt 023.phpt
Modified files:
/php-src/ext/tidy tidy.c
/php-src/ext/tidy/tests 007.phpt 020.phpt
Log:
sync code and tests between HEAD and PHP_5_2 branches. what a confusion...
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.66.2.8.2.11&r2=1.66.2.8.2.12&diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.66.2.8.2.11
php-src/ext/tidy/tidy.c:1.66.2.8.2.12
--- php-src/ext/tidy/tidy.c:1.66.2.8.2.11 Tue Sep 5 14:55:56 2006
+++ php-src/ext/tidy/tidy.c Tue Sep 5 15:23:26 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tidy.c,v 1.66.2.8.2.11 2006/09/05 14:55:56 nlopess Exp $ */
+/* $Id: tidy.c,v 1.66.2.8.2.12 2006/09/05 15:23:26 nlopess Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -358,7 +358,7 @@
{NULL, NULL, NULL}
};
-zend_class_entry *tidy_ce_doc, *tidy_ce_node, *tidy_ce_exception;
+static zend_class_entry *tidy_ce_doc, *tidy_ce_node;
static zend_object_handlers tidy_object_handlers_doc;
static zend_object_handlers tidy_object_handlers_node;
@@ -1027,7 +1027,7 @@
php_info_print_table_start();
php_info_print_table_header(2, "Tidy support", "enabled");
php_info_print_table_row(2, "libTidy Release", (char
*)tidyReleaseDate());
- php_info_print_table_row(2, "Extension Version",
PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.66.2.8.2.11 2006/09/05 14:55:56
nlopess Exp $)");
+ php_info_print_table_row(2, "Extension Version",
PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.66.2.8.2.12 2006/09/05 15:23:26
nlopess Exp $)");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/007.phpt?r1=1.9&r2=1.9.4.1&diff_format=u
Index: php-src/ext/tidy/tests/007.phpt
diff -u php-src/ext/tidy/tests/007.phpt:1.9
php-src/ext/tidy/tests/007.phpt:1.9.4.1
--- php-src/ext/tidy/tests/007.phpt:1.9 Mon Nov 22 15:12:32 2004
+++ php-src/ext/tidy/tests/007.phpt Tue Sep 5 15:23:26 2006
@@ -13,9 +13,17 @@
var_dump($a->getopt("error-file"));
echo "Current Value of 'tab-size': ";
var_dump($a->getopt("tab-size"));
-
+
+ var_dump($a->getopt('bogus-opt'));
+ var_dump(tidy_getopt($a, 'non-ASCII string àáç'));
?>
---EXPECT--
+--EXPECTF--
Current Value of 'tidy-mark': bool(false)
Current Value of 'error-file': string(0) ""
Current Value of 'tab-size': int(8)
+
+Warning: tidy::getOpt(): Unknown Tidy Configuration Option 'bogus-opt' in
%s007.php on line 10
+bool(false)
+
+Warning: tidy_getopt(): Unknown Tidy Configuration Option 'non-ASCII string
àáç' in %s007.php on line 11
+bool(false)
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/020.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/tidy/tests/020.phpt
diff -u php-src/ext/tidy/tests/020.phpt:1.1.2.2
php-src/ext/tidy/tests/020.phpt:1.1.2.3
--- php-src/ext/tidy/tests/020.phpt:1.1.2.2 Tue Sep 5 14:55:56 2006
+++ php-src/ext/tidy/tests/020.phpt Tue Sep 5 15:23:26 2006
@@ -1,49 +1,36 @@
--TEST--
-tidy and tidyNode OO
+OO API
--SKIPIF--
-<?php if (!extension_loaded('tidy')) echo 'skip'; ?>
+<?php if (!extension_loaded("tidy")) print "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());
+$str = <<<EOF
+<p>Isto é um texto em Português<br>
+para testes.</p>
+EOF;
+
+$tidy->parseString($str, array('output-xhtml'=>1), 'latin1');
+$tidy->cleanRepair();
+$tidy->diagnose();
+var_dump(tidy_warning_count($tidy) > 0);
+var_dump(strlen($tidy->errorBuffer) > 50);
+echo $tidy;
?>
--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)
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title></title>
+</head>
+<body>
+<p>Isto é um texto em Português<br />
+para testes.</p>
+</body>
+</html>
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/021.phpt?view=markup&rev=1.1
Index: php-src/ext/tidy/tests/021.phpt
+++ php-src/ext/tidy/tests/021.phpt
--TEST--
tidy_get_opt_doc()
--SKIPIF--
<?php if (!extension_loaded("tidy") || !function_exists('tidy_get_opt_doc'))
print "skip"; ?>
--FILE--
<?php
var_dump(tidy_get_opt_doc(new tidy, 'some_bogus_cfg'));
$t = new tidy;
var_dump($t->getOptDoc('ncr'));
var_dump(strlen(tidy_get_opt_doc($t, 'wrap')) > 99);
?>
--EXPECT--
Warning: tidy_get_opt_doc(): Unknown Tidy Configuration Option 'some_bogus_cfg'
in /cvs/php-src/ext/tidy/tests/021.php on line 3
bool(false)
string(73) "This option specifies if Tidy should allow numeric character
references. "
bool(true)
--UEXPECT--
Warning: tidy_get_opt_doc(): Unknown Tidy Configuration Option 'some_bogus_cfg'
in /cvs/php-src/ext/tidy/tests/021.php on line 3
bool(false)
unicode(73) "This option specifies if Tidy should allow numeric character
references. "
bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/022.phpt?view=markup&rev=1.1
Index: php-src/ext/tidy/tests/022.phpt
+++ php-src/ext/tidy/tests/022.phpt
--TEST--
tidy_repair_*() and invalid parameters
--SKIPIF--
<?php if (!extension_loaded("tidy")) print "skip"; ?>
--FILE--
<?php
$l = 1;
$s = "";
$a = array();
tidy_repair_string($s, $l, $l, $l);
tidy_repair_string($s, $s, $s, $s);
tidy_repair_string($l, $l, $l ,$l);
tidy_repair_string($a, $a, $a, $a);
tidy_repair_file($s, $l, $l, $l);
tidy_repair_file($s, $s, $s, $s);
tidy_repair_file($l, $l, $l ,$l);
tidy_repair_file($a, $a, $a, $a);
echo "Done\n";
?>
--EXPECTF--
Warning: tidy_repair_string(): Could not load configuration file '1' in %s on
line %d
Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d
Warning: tidy_repair_string(): Could not load configuration file '' in %s on
line %d
Warning: tidy_repair_string(): Could not load configuration file '1' in %s on
line %d
Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d
Warning: tidy_repair_string() expects parameter 1 to be string, array given in
%s on line %d
Warning: tidy_repair_file() expects parameter 1 to be string, array given in %s
on line %d
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/023.phpt?view=markup&rev=1.1
Index: php-src/ext/tidy/tests/023.phpt
+++ php-src/ext/tidy/tests/023.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php