1--TEST--
2Test get_html_translation_table() function : basic functionality - HTML5 /sjis
3--FILE--
4<?php
5echo "*** Testing get_html_translation_table() : basic functionality/HTML5/SJIS ***\n";
6echo "*** Only basic entities supported! ***\n";
7
8echo "-- with table = HTML_ENTITIES, ENT_QUOTES --\n";
9$table = HTML_ENTITIES;
10$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "SJIS");
11asort( $tt );
12var_dump( count($tt) );
13print_r( $tt );
14
15echo "-- with table = HTML_ENTITIES, ENT_COMPAT --\n";
16$table = HTML_ENTITIES;
17$tt = get_html_translation_table($table, ENT_COMPAT | ENT_HTML5, "SJIS");
18var_dump( count($tt) );
19
20echo "-- with table = HTML_ENTITIES, ENT_NOQUOTES --\n";
21$table = HTML_ENTITIES;
22$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "SJIS");
23var_dump( count($tt) );
24
25echo "-- with table = HTML_SPECIALCHARS, ENT_COMPAT --\n";
26$table = HTML_SPECIALCHARS;
27$tt = get_html_translation_table($table, ENT_COMPAT, "SJIS");
28asort( $tt );
29var_dump( count($tt) );
30print_r( $tt );
31
32echo "-- with table = HTML_SPECIALCHARS, ENT_QUOTES --\n";
33$table = HTML_SPECIALCHARS;
34$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "SJIS");
35asort( $tt );
36var_dump( $tt );
37
38echo "-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --\n";
39$table = HTML_SPECIALCHARS;
40$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "SJIS");
41asort( $tt );
42var_dump( $tt );
43
44
45echo "Done\n";
46?>
47--EXPECT--
48*** Testing get_html_translation_table() : basic functionality/HTML5/SJIS ***
49*** Only basic entities supported! ***
50-- with table = HTML_ENTITIES, ENT_QUOTES --
51int(5)
52Array
53(
54    [&] => &amp;
55    ['] => &apos;
56    [>] => &gt;
57    [<] => &lt;
58    ["] => &quot;
59)
60-- with table = HTML_ENTITIES, ENT_COMPAT --
61int(4)
62-- with table = HTML_ENTITIES, ENT_NOQUOTES --
63int(3)
64-- with table = HTML_SPECIALCHARS, ENT_COMPAT --
65int(4)
66Array
67(
68    [&] => &amp;
69    [>] => &gt;
70    [<] => &lt;
71    ["] => &quot;
72)
73-- with table = HTML_SPECIALCHARS, ENT_QUOTES --
74array(5) {
75  ["&"]=>
76  string(5) "&amp;"
77  ["'"]=>
78  string(6) "&apos;"
79  [">"]=>
80  string(4) "&gt;"
81  ["<"]=>
82  string(4) "&lt;"
83  ["""]=>
84  string(6) "&quot;"
85}
86-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --
87array(3) {
88  ["&"]=>
89  string(5) "&amp;"
90  [">"]=>
91  string(4) "&gt;"
92  ["<"]=>
93  string(4) "&lt;"
94}
95Done