Annotation of embedaddon/php/ext/intl/tests/formatter_format_currency.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
1.1.1.2 ! misho 2: numfmt_format_currency() icu <= 4.2
1.1 misho 3: --SKIPIF--
4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
1.1.1.2 ! misho 5: <?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
1.1 misho 6: --FILE--
7: <?php
8:
9: /*
10: * Format a number using misc currencies/locales.
11: */
12: /*
13: * TODO: doesn't pass on ICU 3.6 because 'ru' and 'uk' locales changed
14: * currency formatting.
15: */
16:
17:
18: function ut_main()
19: {
20: $locales = array(
21: 'en_UK' => 'GBP',
22: 'en_US' => 'USD',
23: 'ru' => 'RUR',
24: 'uk' => 'UAH',
25: 'en' => 'UAH'
26: );
27:
28: $res_str = '';
29: $number = 1234567.89;
30:
31: foreach( $locales as $locale => $currency )
32: {
33: $fmt = ut_nfmt_create( $locale, NumberFormatter::CURRENCY );
34: $res_str .= "$locale: " . var_export( ut_nfmt_format_currency( $fmt, $number, $currency ), true ) . "\n";
35: }
36: return $res_str;
37: }
38:
39: include_once( 'ut_common.inc' );
40:
41: // Run the test
42: ut_run();
43:
44: ?>
45: --EXPECT--
46: en_UK: '£1,234,567.89'
47: en_US: '$1,234,567.89'
48: ru: '1 234 567,89 р.'
49: uk: '1 234 567,89 ₴'
1.1.1.2 ! misho 50: en: '₴1,234,567.89'
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>