Annotation of embedaddon/php/ext/intl/tests/locale_get_keywords.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
1.1.1.2 ! misho       2: locale_get_keywords() icu <= 4.2
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.3', '<') != 1) print 'skip'; ?>
1.1       misho       6: --FILE--
                      7: <?php
                      8: 
                      9: /*
                     10:  * Try getting the keywords for different locales
                     11:  * with Procedural and Object methods.
                     12:  */
                     13: 
                     14: function ut_main()
                     15: {
                     16:     $res_str = '';
                     17: 
                     18:     $locales = array(
                     19:                "de_DE@currency=EUR;collation=PHONEBOOK",
                     20:         'uk-ua_CALIFORNIA@currency=GRN'
                     21:        );
                     22: 
                     23:     $locales = array(
                     24:        'de_DE@currency=EUR;collation=PHONEBOOK',
                     25:         'root',
                     26:         'uk@currency=EURO',
                     27:         'Hindi',
                     28: //Simple language subtag
                     29:         'de',
                     30:         'fr',
                     31:         'ja',
                     32:         'i-enochian', //(example of a grandfathered tag)
                     33: //Language subtag plus Script subtag:  
                     34:         'zh-Hant',
                     35:         'zh-Hans',
                     36:         'sr-Cyrl',
                     37:         'sr-Latn',
                     38: //Language-Script-Region
                     39:         'zh-Hans-CN',
                     40:         'sr-Latn-CS',
                     41: //Language-Variant
                     42:         'sl-rozaj',
                     43:         'sl-nedis',
                     44: //Language-Region-Variant
                     45:         'de-CH-1901',
                     46:         'sl-IT-nedis',
                     47: //Language-Script-Region-Variant
                     48:         'sl-Latn-IT-nedis',
                     49: //Language-Region:
                     50:         'de-DE',
                     51:         'en-US',
                     52:         'es-419',
                     53: //Private use subtags:
                     54:         'de-CH-x-phonebk',
                     55:         'az-Arab-x-AZE-derbend',
                     56: //Extended language subtags 
                     57:         'zh-min',
                     58:         'zh-min-nan-Hant-CN',
                     59: //Private use registry values
                     60:         'x-whatever',
                     61:         'qaa-Qaaa-QM-x-southern',
                     62:         'sr-Latn-QM',
                     63:         'sr-Qaaa-CS',
                     64: /*Tags that use extensions (examples ONLY: extensions MUST be defined
                     65:    by revision or update to this document or by RFC): */
                     66:         'en-US-u-islamCal',
                     67:         'zh-CN-a-myExt-x-private',
                     68:         'en-a-myExt-b-another',
                     69: //Some Invalid Tags:
                     70:         'de-419-DE',
                     71:         'a-DE',
                     72:         'ar-a-aaa-b-bbb-a-ccc'
                     73:     );
                     74: 
                     75:     $res_str = '';
                     76: 
                     77:     foreach( $locales as $locale )
                     78:     {
                     79:         $keywords_arr = ut_loc_get_keywords( $locale);
                     80:         $res_str .= "$locale: ";
                     81:                if( $keywords_arr){
                     82:                        foreach( $keywords_arr as $key => $value){
                     83:                                $res_str .= "Key is $key and Value is $value \n";
                     84:                        }
                     85:                }
                     86:                else{
                     87:                        $res_str .= "No keywords found.";
                     88:                }
                     89:         $res_str .= "\n";
                     90:     }
                     91: 
                     92:     $res_str .= "\n";
                     93:     return $res_str;
                     94: 
                     95: }
                     96: 
                     97: include_once( 'ut_common.inc' );
                     98: ut_run();
                     99: 
                    100: ?>
                    101: --EXPECT--
                    102: de_DE@currency=EUR;collation=PHONEBOOK: Key is collation and Value is PHONEBOOK 
                    103: Key is currency and Value is EUR 
                    104: 
                    105: root: No keywords found.
                    106: uk@currency=EURO: Key is currency and Value is EURO 
                    107: 
                    108: Hindi: No keywords found.
                    109: de: No keywords found.
                    110: fr: No keywords found.
                    111: ja: No keywords found.
                    112: i-enochian: No keywords found.
                    113: zh-Hant: No keywords found.
                    114: zh-Hans: No keywords found.
                    115: sr-Cyrl: No keywords found.
                    116: sr-Latn: No keywords found.
                    117: zh-Hans-CN: No keywords found.
                    118: sr-Latn-CS: No keywords found.
                    119: sl-rozaj: No keywords found.
                    120: sl-nedis: No keywords found.
                    121: de-CH-1901: No keywords found.
                    122: sl-IT-nedis: No keywords found.
                    123: sl-Latn-IT-nedis: No keywords found.
                    124: de-DE: No keywords found.
                    125: en-US: No keywords found.
                    126: es-419: No keywords found.
                    127: de-CH-x-phonebk: No keywords found.
                    128: az-Arab-x-AZE-derbend: No keywords found.
                    129: zh-min: No keywords found.
                    130: zh-min-nan-Hant-CN: No keywords found.
                    131: x-whatever: No keywords found.
                    132: qaa-Qaaa-QM-x-southern: No keywords found.
                    133: sr-Latn-QM: No keywords found.
                    134: sr-Qaaa-CS: No keywords found.
                    135: en-US-u-islamCal: No keywords found.
                    136: zh-CN-a-myExt-x-private: No keywords found.
                    137: en-a-myExt-b-another: No keywords found.
                    138: de-419-DE: No keywords found.
                    139: a-DE: No keywords found.
                    140: ar-a-aaa-b-bbb-a-ccc: No keywords found.

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>