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