summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/get_html_translation_table_basic3.phpt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/strings/get_html_translation_table_basic3.phpt
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/strings/get_html_translation_table_basic3.phpt')
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic3.phpt71
1 files changed, 71 insertions, 0 deletions
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic3.phpt b/ext/standard/tests/strings/get_html_translation_table_basic3.phpt
new file mode 100644
index 0000000..4e1cddd
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic3.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - table as HTML_SPECIALCHARS
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* test get_html_translation_table() when $table argument is specified as HTML_SPECIALCHARS */
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+// $table as HTML_SEPCIALCHARS and different quote style
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --\n";
+$table = HTML_SPECIALCHARS;
+$quote_style = ENT_COMPAT;
+$tt = get_html_translation_table($table, $quote_style, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --\n";
+$quote_style = ENT_QUOTES;
+$tt = get_html_translation_table($table, $quote_style, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --\n";
+$quote_style = ENT_NOQUOTES;
+$tt = get_html_translation_table($table, $quote_style, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --
+array(5) {
+ ["'"]=>
+ string(6) "&#039;"
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+}
+Done