xref: /PHP-8.0/ext/tidy/tests/007.phpt (revision 7476d2c1)
1--TEST--
2Verbose  tidy_getopt()
3--SKIPIF--
4<?php if (!extension_loaded("tidy")) print "skip"; ?>
5--INI--
6tidy.default_config=
7--FILE--
8<?php
9$a = new tidy(__DIR__."/007.html");
10echo "Current Value of 'tidy-mark': ";
11var_dump($a->getopt("tidy-mark"));
12echo "Current Value of 'error-file': ";
13var_dump($a->getopt("error-file"));
14echo "Current Value of 'tab-size': ";
15var_dump($a->getopt("tab-size"));
16
17try {
18    $a->getopt('bogus-opt');
19} catch (ValueError $exception) {
20    echo $exception->getMessage() . "\n";
21}
22
23try {
24    tidy_getopt($a, 'non-ASCII string ���');
25} catch (ValueError $exception) {
26    echo $exception->getMessage() . "\n";
27}
28
29?>
30--EXPECTF--
31Current Value of 'tidy-mark': bool(false)
32Current Value of 'error-file': string(0) ""
33Current Value of 'tab-size': int(8)
34tidy::getOpt(): Argument #1 ($option) is an invalid configuration option, "bogus-opt" given
35tidy_getopt(): Argument #2 ($option) is an invalid configuration option, "non-ASCII string ���" given
36