Annotation of embedaddon/php/ext/intl/tests/dateformat_set_timezone_id3.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: datefmt_set_timezone_id_code() icu >= 4.8
        !             3: --INI--
        !             4: date.timezone=Atlantic/Azores
        !             5: --SKIPIF--
        !             6: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
        !             7: <?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
        !             8: --FILE--
        !             9: <?php
        !            10: 
        !            11: ini_set("intl.error_level", E_WARNING);
        !            12: ini_set("error_reporting", ~E_DEPRECATED);
        !            13: 
        !            14: /*
        !            15:  * Test for the datefmt_set_timezone_id  function
        !            16:  */
        !            17: 
        !            18: 
        !            19: function ut_main()
        !            20: {
        !            21:        $timezone_id_arr = array (
        !            22:                'America/New_York',
        !            23:                'America/Los_Angeles',
        !            24:                'America/Chicago',
        !            25:                'CN'
        !            26:        );
        !            27:        $timestamp_entry = 0;
        !            28: 
        !            29:        $res_str = '';
        !            30: 
        !            31:        $fmt = ut_datefmt_create( "en_US",  IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN  );
        !            32:        $timezone_id = ut_datefmt_get_timezone_id( $fmt );
        !            33:        $res_str .= "\nAfter creation of the dateformatter :  timezone_id= $timezone_id\n";
        !            34: 
        !            35:        foreach( $timezone_id_arr as $timezone_id_entry )
        !            36:        {
        !            37: 
        !            38:                $res_str .= "-----------";
        !            39:                $res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
        !            40:                ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
        !            41:                $timezone_id = ut_datefmt_get_timezone_id( $fmt );
        !            42:                $res_str .= "\nAfter call to set_timezone_id :  timezone_id= $timezone_id";
        !            43:                $formatted = ut_datefmt_format( $fmt, 0);
        !            44:                $res_str .= "\nFormatting timestamp=0 resulted in  $formatted";
        !            45:                $formatted = ut_datefmt_format( $fmt, 3600);
        !            46:                $res_str .= "\nFormatting timestamp=3600 resulted in  $formatted";
        !            47:                $res_str .= "\n";
        !            48: 
        !            49:        }
        !            50: 
        !            51:        return $res_str;
        !            52: 
        !            53: }
        !            54: 
        !            55: include_once( 'ut_common.inc' );
        !            56: 
        !            57: // Run the test
        !            58: ut_run();
        !            59: ?>
        !            60: --EXPECTF--
        !            61: Warning: IntlDateFormatter::setTimeZoneId(): datefmt_set_timezone: no such time zone: 'CN' in %sut_common.inc on line %d
        !            62: 
        !            63: Warning: datefmt_set_timezone_id(): datefmt_set_timezone: no such time zone: 'CN' in %sut_common.inc on line %d
        !            64: 
        !            65: After creation of the dateformatter :  timezone_id= US/Pacific
        !            66: -----------
        !            67: Trying to set timezone_id= America/New_York
        !            68: After call to set_timezone_id :  timezone_id= America/New_York
        !            69: Formatting timestamp=0 resulted in  Wednesday, December 31, 1969 at 7:00:00 PM Eastern Standard Time
        !            70: Formatting timestamp=3600 resulted in  Wednesday, December 31, 1969 at 8:00:00 PM Eastern Standard Time
        !            71: -----------
        !            72: Trying to set timezone_id= America/Los_Angeles
        !            73: After call to set_timezone_id :  timezone_id= America/Los_Angeles
        !            74: Formatting timestamp=0 resulted in  Wednesday, December 31, 1969 at 4:00:00 PM Pacific Standard Time
        !            75: Formatting timestamp=3600 resulted in  Wednesday, December 31, 1969 at 5:00:00 PM Pacific Standard Time
        !            76: -----------
        !            77: Trying to set timezone_id= America/Chicago
        !            78: After call to set_timezone_id :  timezone_id= America/Chicago
        !            79: Formatting timestamp=0 resulted in  Wednesday, December 31, 1969 at 6:00:00 PM Central Standard Time
        !            80: Formatting timestamp=3600 resulted in  Wednesday, December 31, 1969 at 7:00:00 PM Central Standard Time
        !            81: -----------
        !            82: Trying to set timezone_id= CN
        !            83: After call to set_timezone_id :  timezone_id= America/Chicago
        !            84: Formatting timestamp=0 resulted in  Wednesday, December 31, 1969 at 6:00:00 PM Central Standard Time
        !            85: Formatting timestamp=3600 resulted in  Wednesday, December 31, 1969 at 7:00:00 PM Central Standard Time

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