xref: /PHP-7.4/ext/tidy/tests/004.phpt (revision 782352c5)
1--TEST--
2tidy_diagnose()
3--SKIPIF--
4<?php if (!extension_loaded("tidy")) print "skip"; ?>
5--FILE--
6<?php
7$a = tidy_parse_string('<HTML></HTML>');
8var_dump(tidy_diagnose($a));
9echo str_replace("\r", "", tidy_get_error_buffer($a));
10
11$html = <<< HTML
12<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
13<html>
14<head><title>foo</title></head>
15<body><p>hello</p></body>
16</html>
17HTML;
18$a = tidy_parse_string($html);
19var_dump(tidy_diagnose($a));
20echo tidy_get_error_buffer($a);
21?>
22--EXPECTF--
23bool(true)
24line 1 column 1 - Warning: missing <!DOCTYPE> declaration
25line 1 column 7 - Warning: discarding unexpected </html>
26line 1 column 14 - Warning: inserting missing 'title' element
27Info: Document content looks like HTML%w%d%S
28%S3 warnings%S0 errors%S
29bool(true)
30Info: Document content looks like HTML 3.2
31No warnings or errors were found.
32