]> granicus.if.org Git - php/commitdiff
Add test for bug #76942
authorAnatol Belski <ab@php.net>
Fri, 5 Oct 2018 20:51:58 +0000 (22:51 +0200)
committerAnatol Belski <ab@php.net>
Fri, 5 Oct 2018 20:54:50 +0000 (22:54 +0200)
ext/intl/tests/bug76942_MessageFormatter.phpt [new file with mode: 0644]

diff --git a/ext/intl/tests/bug76942_MessageFormatter.phpt b/ext/intl/tests/bug76942_MessageFormatter.phpt
new file mode 100644 (file)
index 0000000..baafb00
--- /dev/null
@@ -0,0 +1,33 @@
+--TEST--
+Bug #76942 U_ARGUMENT_TYPE_MISMATCH
+--SKIPIF--
+<?php
+if (!extension_loaded('intl'))
+       die('skip intl extension not enabled');
+?>
+--FILE--
+<?php
+
+$locale = 'nl';
+$message = '{0,number,#,###.##} MB';
+$vars = [
+    7.1234
+];
+
+$formatter = new MessageFormatter($locale, $message);
+if (!$formatter) {
+    throw new Exception(intl_get_error_message(), intl_get_error_code());
+}
+
+$result = $formatter->format($vars);
+if ($result === false) {
+    throw new Exception($formatter->getErrorMessage(), $formatter->getErrorCode());
+}
+
+var_dump($result);
+
+?>
+==DONE==
+--EXPECT--
+string(7) "7,12 MB"
+==DONE==