summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt')
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt42
1 files changed, 42 insertions, 0 deletions
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt
new file mode 100644
index 000000000..dc027398d
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test htmlspecialchars_decode() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+echo "*** Testing htmlspecialchars_decode() : basic functionality ***\n";
+
+
+// Initialise arguments
+//value initialized = Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. "double quoted string"
+$single_quote_string = "Roy&#039;s height &gt; Sam&#039;s height. 13 &lt; 25. 1111 &amp; 0000 = 0000. &quot; double quoted string &quot;";
+$double_quote_string = "Roy&#039;s height &gt; Sam&#039;s height. 13 &lt; 25. 1111 &amp; 0000 = 0000. &quot; double quoted string &quot;";
+
+// Calling htmlspecialchars_decode() with default arguments
+var_dump( htmlspecialchars_decode($single_quote_string) );
+var_dump( htmlspecialchars_decode($double_quote_string) );
+
+// Calling htmlspecialchars_decode() with optional 'quote_style' argument
+var_dump( htmlspecialchars_decode($single_quote_string, ENT_COMPAT) );
+var_dump( htmlspecialchars_decode($double_quote_string, ENT_COMPAT) );
+var_dump( htmlspecialchars_decode($single_quote_string, ENT_NOQUOTES) );
+var_dump( htmlspecialchars_decode($double_quote_string, ENT_NOQUOTES) );
+var_dump( htmlspecialchars_decode($single_quote_string, ENT_QUOTES) );
+var_dump( htmlspecialchars_decode($double_quote_string, ENT_QUOTES) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : basic functionality ***
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(102) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. &quot; double quoted string &quot;"
+string(102) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. &quot; double quoted string &quot;"
+string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+Done