2008-07-07 22:51:04 +00:00
|
|
|
|
--TEST--
|
2012-03-28 11:59:51 +00:00
|
|
|
|
numfmt_format_currency() icu <= 4.2
|
2008-07-07 22:51:04 +00:00
|
|
|
|
--SKIPIF--
|
|
|
|
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
2012-03-28 11:59:51 +00:00
|
|
|
|
<?php if(version_compare(INTL_ICU_VERSION, '4.3', '<') != 1) print 'skip'; ?>
|
2008-07-07 22:51:04 +00:00
|
|
|
|
--FILE--
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Format a number using misc currencies/locales.
|
|
|
|
|
*/
|
2011-01-04 03:24:38 +00:00
|
|
|
|
/*
|
2008-09-04 19:59:37 +00:00
|
|
|
|
* TODO: doesn't pass on ICU 3.6 because 'ru' and 'uk' locales changed
|
|
|
|
|
* currency formatting.
|
|
|
|
|
*/
|
2008-07-07 22:51:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
?>
|
2011-01-04 03:24:38 +00:00
|
|
|
|
--EXPECT--
|
2008-07-07 22:51:04 +00:00
|
|
|
|
en_UK: '£1,234,567.89'
|
2011-01-04 03:24:38 +00:00
|
|
|
|
en_US: '$1,234,567.89'
|
|
|
|
|
ru: '1 234 567,89 р.'
|
|
|
|
|
uk: '1 234 567,89 ₴'
|
2012-03-28 11:59:51 +00:00
|
|
|
|
en: '₴1,234,567.89'
|