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