Date/Time: Improve `date_i18n()` timezone tests.

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

Fixes #37910.

git-svn-id: https://develop.svn.wordpress.org/trunk@39167 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler 2016-11-08 22:31:51 +00:00
parent b955bdd506
commit 4b3e128140
1 changed files with 5 additions and 5 deletions

View File

@ -22,19 +22,19 @@ class Tests_Date_I18n extends WP_UnitTestCase {
}
public function test_custom_timezone_setting() {
update_option( 'timezone_string', 'Europe/Zurich' );
update_option( 'timezone_string', 'America/Regina' );
$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 );
}
public function test_date_should_be_in_gmt_with_custom_timezone_setting() {
update_option( 'timezone_string', 'Europe/Zurich' );
update_option( 'timezone_string', 'America/Regina' );
$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 );
}
public function test_date_should_be_in_gmt_with_custom_timezone_setting_and_timestamp() {
update_option( 'timezone_string', 'Europe/Zurich' );
update_option( 'timezone_string', 'America/Regina' );
$this->assertEquals( '2012-12-01 00:00:00', date_i18n( 'Y-m-d H:i:s', strtotime( '2012-12-01 00:00:00' ) ) );
}
@ -63,8 +63,8 @@ class Tests_Date_I18n extends WP_UnitTestCase {
}
public function test_adjusts_format_based_on_timezone_string() {
update_option( 'timezone_string', 'Europe/Zurich' );
update_option( 'timezone_string', 'America/Regina' );
$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' ) ) );
$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' ) ) );
}
}