Annotation of embedaddon/php/ext/intl/tests/dateformat_get_locale.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: datefmt_get_locale_code()
3: --SKIPIF--
4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5: --FILE--
6: <?php
7:
8: /*
9: * Test for the datefmt_get_locale function
10: */
11:
12:
13: function ut_main()
14: {
15: $locale_arr = array (
16: 'de-DE',
17: 'sl-IT-nedis',
18: 'en_UK',
19: 'hi'
20: );
21:
22: $res_str = '';
23:
24: foreach( $locale_arr as $locale_entry )
25: {
26: $res_str .= "\nCreating IntlDateFormatter with locale = $locale_entry";
27: $fmt = ut_datefmt_create( $locale_entry , IntlDateFormatter::SHORT,IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN );
28: $locale = ut_datefmt_get_locale( $fmt , 1);
29: $res_str .= "\nAfter call to get_locale : locale= $locale";
30: $res_str .= "\n";
31: }
32: $badvals = array(100, -1, 4294901761);
33: foreach($badvals as $badval) {
34: if(ut_datefmt_get_locale($fmt, $badval)) {
35: $res_str .= "datefmt_get_locale should return false for bad argument $badval\n";
36: }
37: }
38:
39: return $res_str;
40:
41: }
42:
43: include_once( 'ut_common.inc' );
44:
45: // Run the test
46: ut_run();
47: ?>
48: --EXPECT--
49: Creating IntlDateFormatter with locale = de-DE
50: After call to get_locale : locale= de_DE
51:
52: Creating IntlDateFormatter with locale = sl-IT-nedis
53: After call to get_locale : locale= sl
54:
55: Creating IntlDateFormatter with locale = en_UK
56: After call to get_locale : locale= en
57:
58: Creating IntlDateFormatter with locale = hi
59: After call to get_locale : locale= hi
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>