Make WordPress Core

Changeset 39167


Ignore:
Timestamp:
11/08/2016 10:31:51 PM (7 years ago)
Author:
swissspidy
Message:

Date/Time: Improve date_i18n() timezone tests.

This uses a timezone without DST for the tests covering date_i18n().

Fixes #37910.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/date/dateI18n.php

    r39013 r39167  
    2323
    2424    public function test_custom_timezone_setting() {
    25         update_option( 'timezone_string', 'Europe/Zurich' );
     25        update_option( 'timezone_string', 'America/Regina' );
    2626
    2727        $this->assertEquals( strtotime( date( 'Y-m-d H:i:s', time() + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2 );
     
    2929
    3030    public function test_date_should_be_in_gmt_with_custom_timezone_setting() {
    31         update_option( 'timezone_string', 'Europe/Zurich' );
     31        update_option( 'timezone_string', 'America/Regina' );
    3232
    3333        $this->assertEquals( strtotime( date( 'Y-m-d H:i:s' ) ), strtotime( date_i18n( 'Y-m-d H:i:s', false, true ) ), 'The dates should be equal', 2 );
     
    3535
    3636    public function test_date_should_be_in_gmt_with_custom_timezone_setting_and_timestamp() {
    37         update_option( 'timezone_string', 'Europe/Zurich' );
     37        update_option( 'timezone_string', 'America/Regina' );
    3838
    3939        $this->assertEquals( '2012-12-01 00:00:00', date_i18n( 'Y-m-d H:i:s', strtotime( '2012-12-01 00:00:00' ) ) );
     
    6464
    6565    public function test_adjusts_format_based_on_timezone_string() {
    66         update_option( 'timezone_string', 'Europe/Zurich' );
     66        update_option( 'timezone_string', 'America/Regina' );
    6767
    68         $this->assertEquals( '2012-12-01 00:00:00 CET +01:00 Europe/Zurich', date_i18n( 'Y-m-d H:i:s T P e', strtotime( '2012-12-01 00:00:00' ) ) );
     68        $this->assertEquals( '2012-12-01 00:00:00 CST -06:00 America/Regina', date_i18n( 'Y-m-d H:i:s T P e', strtotime( '2012-12-01 00:00:00' ) ) );
    6969    }
    7070}
Note: See TracChangeset for help on using the changeset viewer.