Annotation of embedaddon/php/ext/intl/tests/collator_create3.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: create() icu >= 53.1
! 3: --SKIPIF--
! 4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
! 5: <?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
! 6: --FILE--
! 7: <?php
! 8:
! 9: /*
! 10: * Try creating collator with different locales
! 11: * with Procedural and Object methods.
! 12: */
! 13:
! 14: function ut_main()
! 15: {
! 16: $res_str = '';
! 17:
! 18: $locales = array(
! 19: 'EN-US-ODESSA',
! 20: 'UK_UA_ODESSA',
! 21: 'uk-ua_CALIFORNIA@currency=;currency=GRN',
! 22: '',
! 23: 'root',
! 24: 'uk@currency=EURO',
! 25: '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
! 26: );
! 27:
! 28: foreach( $locales as $locale )
! 29: {
! 30: // Create Collator with the current locale.
! 31: $coll = ut_coll_create( $locale );
! 32: if( !is_object($coll) )
! 33: {
! 34: $res_str .= "Error creating collator with '$locale' locale: " .
! 35: intl_get_error_message() . "\n";
! 36: continue;
! 37: }
! 38:
! 39: // Get the requested, valid and actual locales.
! 40: $vloc = ut_coll_get_locale( $coll, Locale::VALID_LOCALE );
! 41: $aloc = ut_coll_get_locale( $coll, Locale::ACTUAL_LOCALE );
! 42:
! 43: // Show them.
! 44: $res_str .= "Locale: '$locale'\n" .
! 45: " ULOC_REQUESTED_LOCALE = '$locale'\n" .
! 46: " ULOC_VALID_LOCALE = '$vloc'\n" .
! 47: " ULOC_ACTUAL_LOCALE = '$aloc'\n";
! 48: }
! 49:
! 50: return $res_str;
! 51: }
! 52:
! 53: include_once( 'ut_common.inc' );
! 54: ut_run();
! 55:
! 56: ?>
! 57: --EXPECTF--
! 58: Locale: 'EN-US-ODESSA'
! 59: ULOC_REQUESTED_LOCALE = 'EN-US-ODESSA'
! 60: ULOC_VALID_LOCALE = 'en_US'
! 61: ULOC_ACTUAL_LOCALE = 'root'
! 62: Locale: 'UK_UA_ODESSA'
! 63: ULOC_REQUESTED_LOCALE = 'UK_UA_ODESSA'
! 64: ULOC_VALID_LOCALE = 'uk'
! 65: ULOC_ACTUAL_LOCALE = 'uk'
! 66: Locale: 'uk-ua_CALIFORNIA@currency=;currency=GRN'
! 67: ULOC_REQUESTED_LOCALE = 'uk-ua_CALIFORNIA@currency=;currency=GRN'
! 68: ULOC_VALID_LOCALE = 'root'
! 69: ULOC_ACTUAL_LOCALE = 'root'
! 70: Locale: ''
! 71: ULOC_REQUESTED_LOCALE = ''
! 72: ULOC_VALID_LOCALE = '%s'
! 73: ULOC_ACTUAL_LOCALE = '%s'
! 74: Locale: 'root'
! 75: ULOC_REQUESTED_LOCALE = 'root'
! 76: ULOC_VALID_LOCALE = 'root'
! 77: ULOC_ACTUAL_LOCALE = 'root'
! 78: Locale: 'uk@currency=EURO'
! 79: ULOC_REQUESTED_LOCALE = 'uk@currency=EURO'
! 80: ULOC_VALID_LOCALE = 'uk'
! 81: ULOC_ACTUAL_LOCALE = 'uk'
! 82: Error creating collator with '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than 80 characters: U_ILLEGAL_ARGUMENT_ERROR
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>