1--TEST--
2datefmt_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
13function 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
43include_once( 'ut_common.inc' );
44
45// Run the test
46ut_run();
47?>
48--EXPECT--
49Creating IntlDateFormatter with calendar = 1
50After call to get_calendar :  calendar= 1
51-------------------
52Setting IntlDateFormatter with calendar = 1
53After call to get_calendar :  calendar= 1
54-------------------
55Setting IntlDateFormatter with calendar = 0
56After call to get_calendar :  calendar= 0
57-------------------
58Setting IntlDateFormatter with calendar = 3
59After call to get_calendar :  calendar= 0
60-------------------