Annotation of embedaddon/php/ext/intl/tests/dateformat_set_timezone_id.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: datefmt_set_timezone_id_code()
! 3: --SKIPIF--
! 4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: /*
! 9: * Test for the datefmt_set_timezone_id function
! 10: */
! 11:
! 12:
! 13: function ut_main()
! 14: {
! 15: $timezone_id_arr = array (
! 16: 'America/New_York',
! 17: 'America/Los_Angeles',
! 18: 'America/Chicago',
! 19: 'CN'
! 20: );
! 21: $timestamp_entry = 0;
! 22:
! 23: $res_str = '';
! 24:
! 25: $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/San_Francisco' , IntlDateFormatter::GREGORIAN );
! 26: $timezone_id = ut_datefmt_get_timezone_id( $fmt );
! 27: $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n";
! 28:
! 29: foreach( $timezone_id_arr as $timezone_id_entry )
! 30: {
! 31:
! 32: $res_str .= "-----------";
! 33: $res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
! 34: ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
! 35: $timezone_id = ut_datefmt_get_timezone_id( $fmt );
! 36: $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id";
! 37: $formatted = ut_datefmt_format( $fmt, 0);
! 38: $res_str .= "\nFormatting timestamp=0 resulted in $formatted";
! 39: $formatted = ut_datefmt_format( $fmt, 3600);
! 40: $res_str .= "\nFormatting timestamp=3600 resulted in $formatted";
! 41: $res_str .= "\n";
! 42:
! 43: }
! 44:
! 45: return $res_str;
! 46:
! 47: }
! 48:
! 49: include_once( 'ut_common.inc' );
! 50:
! 51: // Run the test
! 52: ut_run();
! 53: ?>
! 54: --EXPECT--
! 55: After creation of the dateformatter : timezone_id= America/San_Francisco
! 56: -----------
! 57: Trying to set timezone_id= America/New_York
! 58: After call to set_timezone_id : timezone_id= America/New_York
! 59: Formatting timestamp=0 resulted in Wednesday, December 31, 1969 7:00:00 PM Eastern Standard Time
! 60: Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 8:00:00 PM Eastern Standard Time
! 61: -----------
! 62: Trying to set timezone_id= America/Los_Angeles
! 63: After call to set_timezone_id : timezone_id= America/Los_Angeles
! 64: Formatting timestamp=0 resulted in Wednesday, December 31, 1969 4:00:00 PM Pacific Standard Time
! 65: Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 5:00:00 PM Pacific Standard Time
! 66: -----------
! 67: Trying to set timezone_id= America/Chicago
! 68: After call to set_timezone_id : timezone_id= America/Chicago
! 69: Formatting timestamp=0 resulted in Wednesday, December 31, 1969 6:00:00 PM Central Standard Time
! 70: Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 7:00:00 PM Central Standard Time
! 71: -----------
! 72: Trying to set timezone_id= CN
! 73: After call to set_timezone_id : timezone_id= CN
! 74: Formatting timestamp=0 resulted in Thursday, January 1, 1970 12:00:00 AM GMT+00:00
! 75: Formatting timestamp=3600 resulted in Thursday, January 1, 1970 1:00:00 AM GMT+00:00
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>