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