Skip to content

Commit

Permalink
Fixed tidy tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilia Alshanetsky committed Dec 19, 2003
1 parent 02a9316 commit 9f50065
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 45 deletions.
11 changes: 7 additions & 4 deletions ext/tidy/tests/002.phpt
Expand Up @@ -7,10 +7,13 @@ tidy_parse_string()
--INI--
--FILE--
<?php
tidy_parse_string("<HTML></HTML>");

echo tidy_get_output();

if (class_exists("tidy_doc")) {
$a = tidy_parse_string("<HTML></HTML>");
echo tidy_get_output($a);
} else {
tidy_parse_string("<HTML></HTML>");
echo tidy_get_output();
}
?>
--EXPECT--
<html>
Expand Down
15 changes: 9 additions & 6 deletions ext/tidy/tests/003.phpt
Expand Up @@ -7,12 +7,15 @@ tidy_clean_repair()
--INI--
--FILE--
<?php

tidy_parse_string("<HTML></HTML>");
tidy_clean_repair();

echo tidy_get_output();

if (class_exists("tidy_doc")) {
$a = tidy_parse_string("<HTML></HTML>");
tidy_clean_repair($a);
echo tidy_get_output($a);
} else {
tidy_parse_string("<HTML></HTML>");
tidy_clean_repair();
echo tidy_get_output();
}
?>
--EXPECT--
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
Expand Down
13 changes: 9 additions & 4 deletions ext/tidy/tests/004.phpt
Expand Up @@ -7,10 +7,15 @@ tidy_diagnose()
--INI--
--FILE--
<?php
tidy_parse_string("<HTML></HTML>");
tidy_diagnose();
echo tidy_get_error_buffer();

if (class_exists("tidy_doc")) {
$a = tidy_parse_string("<HTML></HTML>");
tidy_diagnose($a);
echo tidy_get_error_buffer($a);
} else {
tidy_parse_string("<HTML></HTML>");
tidy_diagnose();
echo tidy_get_error_buffer();
}
?>
--EXPECT--

Expand Down
12 changes: 7 additions & 5 deletions ext/tidy/tests/005.phpt
Expand Up @@ -7,11 +7,13 @@ tidy_parse_file()
--INI--
--FILE--
<?php

tidy_parse_file("ext/tidy/tests/005.html");

echo tidy_get_output();

if (class_exists("tidy_doc")) {
$a = tidy_parse_file("ext/tidy/tests/005.html");
echo tidy_get_output($a);
} else {
tidy_parse_file("ext/tidy/tests/005.html");
echo tidy_get_output();
}
?>
--EXPECT--
<html>
Expand Down
12 changes: 7 additions & 5 deletions ext/tidy/tests/006.phpt
Expand Up @@ -7,11 +7,13 @@ Verbose tidy_get_error_buffer()
--INI--
--FILE--
<?php

tidy_parse_string("<HTML><asd asdf></HTML>");

echo tidy_get_error_buffer(true);

if (class_exists("tidy_doc")) {
$a = tidy_parse_string("<HTML><asd asdf></HTML>");
echo tidy_get_error_buffer($a);
} else {
tidy_parse_string("<HTML><asd asdf></HTML>");
echo tidy_get_error_buffer(true);
}
?>
--EXPECT--
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
Expand Down
59 changes: 38 additions & 21 deletions ext/tidy/tests/007.phpt
Expand Up @@ -2,35 +2,52 @@
Verbose tidy_setopt() / tidy_getopt()
--SKIPIF--
<?php if (!extension_loaded("tidy")) print "skip"; ?>
--POST--
--GET--
--INI--
tidy.default_config=
--FILE--
<?php

echo "Current Value of 'tidy-mark': ";
var_dump(tidy_getopt("tidy-mark"));
tidy_setopt($tidy, "tidy-mark", true);
echo "\nNew Value of 'tidy-mark': ";
var_dump(tidy_getopt("tidy-mark"));
echo "Current Value of 'error-file': ";
var_dump(tidy_getopt("error-file"));
tidy_setopt($tidy, "error-file", "foobar");
echo "\nNew Value of 'error-file': ";
var_dump(tidy_getopt("error-file"));
echo "Current Value of 'tab-size': ";
var_dump(tidy_getopt("tab-size"));
tidy_setopt($tidy, "tab-size", 10);
echo "\nNew Value of 'tab-size': ";
var_dump(tidy_getopt("tab-size"));
<?php
if (class_exists("tidy_doc")) {
$a = new tidy_doc();
echo "Current Value of 'tidy-mark': ";
var_dump($a->getopt("tidy-mark"));
$a->setopt("tidy-mark", true);
echo "\nNew Value of 'tidy-mark': ";
var_dump($a->getopt("tidy-mark"));
echo "Current Value of 'error-file': ";
var_dump($a->getopt("error-file"));
$a->setopt("error-file", "foobar");
echo "\nNew Value of 'error-file': ";
var_dump($a->getopt("error-file"));
echo "Current Value of 'tab-size': ";
var_dump($a->getopt("tab-size"));
$a->setopt("tab-size", 10);
echo "\nNew Value of 'tab-size': ";
var_dump($a->getopt("tab-size"));
} else {
echo "Current Value of 'tidy-mark': ";
var_dump(tidy_getopt("tidy-mark"));
tidy_setopt($tidy, "tidy-mark", true);
echo "\nNew Value of 'tidy-mark': ";
var_dump(tidy_getopt("tidy-mark"));
echo "Current Value of 'error-file': ";
var_dump(tidy_getopt("error-file"));
tidy_setopt($tidy, "error-file", "foobar");
echo "\nNew Value of 'error-file': ";
var_dump(tidy_getopt("error-file"));
echo "Current Value of 'tab-size': ";
var_dump(tidy_getopt("tab-size"));
tidy_setopt($tidy, "tab-size", 10);
echo "\nNew Value of 'tab-size': ";
var_dump(tidy_getopt("tab-size"));
}
?>
--EXPECT--
Current Value of 'tidy-mark': bool(false)
Current Value of 'tidy-mark': NULL

New Value of 'tidy-mark': bool(true)
Current Value of 'error-file': string(0) ""

New Value of 'error-file': string(6) "foobar"
Current Value of 'tab-size': int(8)

New Value of 'tab-size': int(10)
New Value of 'tab-size': int(10)

0 comments on commit 9f50065

Please sign in to comment.