summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Persson <daniel.persson@textalk.se>2015-09-07 22:14:36 +0200
committerAnatol Belski <ab@php.net>2016-04-08 12:31:19 +0200
commitff2af8951986c1192b82b0fe492528d3b758e11c (patch)
tree5db91a8f80f78070c43de0fdb6aaf3214842a5e8
parentc45f7b97a3252767b31d38fd7e761b9291ed2152 (diff)
downloadphp-git-ff2af8951986c1192b82b0fe492528d3b758e11c.tar.gz
Added tests for bug 70451 and 70452
-rw-r--r--ext/intl/tests/bug70451.phpt12
-rw-r--r--ext/intl/tests/bug70452.phpt21
2 files changed, 33 insertions, 0 deletions
diff --git a/ext/intl/tests/bug70451.phpt b/ext/intl/tests/bug70451.phpt
new file mode 100644
index 0000000000..75392c8dad
--- /dev/null
+++ b/ext/intl/tests/bug70451.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #70451 IntlChar::charFromName() not consistent with C library or HHVM
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+var_dump(IntlChar::charFromName("RECYCLING SYMBOL FOR TYPE-1 PLASTICS"));
+var_dump(IntlChar::charFromName("sdfasdfasdfasdf"));
+?>
+--EXPECT--
+int(9843)
+NULL
diff --git a/ext/intl/tests/bug70452.phpt b/ext/intl/tests/bug70452.phpt
new file mode 100644
index 0000000000..f544c03ce3
--- /dev/null
+++ b/ext/intl/tests/bug70452.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #70452 string IntlChar::charName() can sometimes return bool(false)
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+// Rely on the default value for the second parameter
+var_dump(IntlChar::charName("A"));
+// Provide a valid option for the second parameter
+var_dump(IntlChar::charName("A", IntlChar::UNICODE_CHAR_NAME));
+// Another valid option, but with no corresponding name for that given option
+// This properly returns an empty string, as expected
+var_dump(IntlChar::charName("A", IntlChar::UNICODE_10_CHAR_NAME));
+// Provide an invalid value for the second parameter
+var_dump(IntlChar::charName("A", 12345));
+?>
+--EXPECT--
+string(22) "LATIN CAPITAL LETTER A"
+string(22) "LATIN CAPITAL LETTER A"
+string(0) ""
+NULL \ No newline at end of file