summaryrefslogtreecommitdiff
path: root/ext/intl/tests/formatter_format_currency2.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/intl/tests/formatter_format_currency2.phpt')
-rw-r--r--ext/intl/tests/formatter_format_currency2.phpt50
1 files changed, 50 insertions, 0 deletions
diff --git a/ext/intl/tests/formatter_format_currency2.phpt b/ext/intl/tests/formatter_format_currency2.phpt
new file mode 100644
index 0000000000..d9277f3e98
--- /dev/null
+++ b/ext/intl/tests/formatter_format_currency2.phpt
@@ -0,0 +1,50 @@
+--TEST--
+numfmt_format_currency() icu >= 4.8
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
+--FILE--
+<?php
+
+/*
+ * Format a number using misc currencies/locales.
+ */
+/*
+ * TODO: doesn't pass on ICU 3.6 because 'ru' and 'uk' locales changed
+ * currency formatting.
+ */
+
+
+function ut_main()
+{
+ $locales = array(
+ 'en_UK' => 'GBP',
+ 'en_US' => 'USD',
+ 'ru' => 'RUR',
+ 'uk' => 'UAH',
+ 'en' => 'UAH'
+ );
+
+ $res_str = '';
+ $number = 1234567.89;
+
+ foreach( $locales as $locale => $currency )
+ {
+ $fmt = ut_nfmt_create( $locale, NumberFormatter::CURRENCY );
+ $res_str .= "$locale: " . var_export( ut_nfmt_format_currency( $fmt, $number, $currency ), true ) . "\n";
+ }
+ return $res_str;
+}
+
+include_once( 'ut_common.inc' );
+
+// Run the test
+ut_run();
+
+?>
+--EXPECT--
+en_UK: '£1,234,567.89'
+en_US: '$1,234,567.89'
+ru: '1 234 567,89 р.'
+uk: '1 234 567,89 ₴'
+en: 'UAH1,234,567.89'