1--TEST--
2Test get_html_translation_table() function : basic functionality - table as HTML_SPECIALCHARS
3--FILE--
4<?php
5/* test get_html_translation_table() when $table argument is specified as HTML_SPECIALCHARS */
6
7echo "*** Testing get_html_translation_table() : basic functionality ***\n";
8
9// $table as HTML_SEPCIALCHARS and different quote style
10echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --\n";
11$table = HTML_SPECIALCHARS;
12$quote_style = ENT_COMPAT;
13$tt = get_html_translation_table($table, $quote_style, "UTF-8");
14asort( $tt );
15var_dump( $tt );
16
17echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --\n";
18$quote_style = ENT_QUOTES;
19$tt = get_html_translation_table($table, $quote_style, "UTF-8");
20asort( $tt );
21var_dump( $tt );
22
23echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --\n";
24$quote_style = ENT_NOQUOTES;
25$tt = get_html_translation_table($table, $quote_style, "UTF-8");
26asort( $tt );
27var_dump( $tt );
28
29echo "Done\n";
30?>
31--EXPECT--
32*** Testing get_html_translation_table() : basic functionality ***
33-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --
34array(4) {
35  ["&"]=>
36  string(5) "&amp;"
37  [">"]=>
38  string(4) "&gt;"
39  ["<"]=>
40  string(4) "&lt;"
41  ["""]=>
42  string(6) "&quot;"
43}
44-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --
45array(5) {
46  ["'"]=>
47  string(6) "&#039;"
48  ["&"]=>
49  string(5) "&amp;"
50  [">"]=>
51  string(4) "&gt;"
52  ["<"]=>
53  string(4) "&lt;"
54  ["""]=>
55  string(6) "&quot;"
56}
57-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --
58array(3) {
59  ["&"]=>
60  string(5) "&amp;"
61  [">"]=>
62  string(4) "&gt;"
63  ["<"]=>
64  string(4) "&lt;"
65}
66Done
67