]> granicus.if.org Git - php/commitdiff
Added tests for bug 70451 and 70452
authorDaniel Persson <daniel.persson@textalk.se>
Mon, 7 Sep 2015 20:14:36 +0000 (22:14 +0200)
committerAnatol Belski <ab@php.net>
Fri, 8 Apr 2016 10:31:19 +0000 (12:31 +0200)
ext/intl/tests/bug70451.phpt [new file with mode: 0644]
ext/intl/tests/bug70452.phpt [new file with mode: 0644]

diff --git a/ext/intl/tests/bug70451.phpt b/ext/intl/tests/bug70451.phpt
new file mode 100644 (file)
index 0000000..75392c8
--- /dev/null
@@ -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 (file)
index 0000000..f544c03
--- /dev/null
@@ -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