Annotation of embedaddon/php/ext/intl/tests/dateformat_get_set_calendar.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: datefmt_get_calendar_code() datefmt_set_calendar_code()
3: --SKIPIF--
4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5: --FILE--
6: <?php
7:
8: /*
9: * Test for the datefmt_get_calendar and datefmt_set_calendar functions
10: */
11:
12:
13: function ut_main()
14: {
15: $calendar_arr = array (
16: IntlDateFormatter::GREGORIAN,
17: IntlDateFormatter::TRADITIONAL,
18: 3
19: );
20:
21: $res_str = '';
22:
23: $start_calendar = IntlDateFormatter::GREGORIAN;
24: $res_str .= "\nCreating IntlDateFormatter with calendar = $start_calendar";
25: $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT ,'America/Los_Angeles', IntlDateFormatter::GREGORIAN);
26: $calendar = ut_datefmt_get_calendar( $fmt);
27: $res_str .= "\nAfter call to get_calendar : calendar= $calendar";
28: $res_str .= "\n-------------------";
29:
30: foreach( $calendar_arr as $calendar_entry )
31: {
32: $res_str .= "\nSetting IntlDateFormatter with calendar = $calendar_entry";
33: ut_datefmt_set_calendar( $fmt, $calendar_entry);
34: $calendar = ut_datefmt_get_calendar( $fmt);
35: $res_str .= "\nAfter call to get_calendar : calendar= $calendar";
36: $res_str .= "\n-------------------";
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 calendar = 1
50: After call to get_calendar : calendar= 1
51: -------------------
52: Setting IntlDateFormatter with calendar = 1
53: After call to get_calendar : calendar= 1
54: -------------------
55: Setting IntlDateFormatter with calendar = 0
56: After call to get_calendar : calendar= 0
57: -------------------
58: Setting IntlDateFormatter with calendar = 3
59: After call to get_calendar : calendar= 0
60: -------------------
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>