REST API: Fix DST handling in a test.

The time chosen for `test_empty_post_date_gmt_shimmed_using_post_date` falls within US daylight savings time.  This may cause the test to fail depending on whether the current locale has DST.

The fix is to specify a numeric `gmt_offset` rather than a `timezone_string`.

Unprops jnylen0.
Fixes #40136.


git-svn-id: https://develop.svn.wordpress.org/trunk@40284 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
James Nylen 2017-03-13 15:06:10 +00:00
parent 69399f4463
commit b9dd2c01f3
1 changed files with 3 additions and 1 deletions

View File

@ -2242,7 +2242,8 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
global $wpdb;
wp_set_current_user( self::$editor_id );
update_option( 'timezone_string', 'America/Chicago' );
update_option( 'timezone_string', '' );
update_option( 'gmt_offset', -6 );
// Need to set dates using wpdb directly because `wp_update_post` and
// `wp_insert_post` have additional validation on dates.
@ -2287,6 +2288,7 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
$this->assertEquals( $post->post_date_gmt, '2016-02-23 19:00:00' );
update_option( 'timezone_string', '' );
update_option( 'gmt_offset', 0 );
}
public function test_update_post_slug() {