From b9dd2c01f3523cde5216c4058068884e2a3eb003 Mon Sep 17 00:00:00 2001 From: James Nylen Date: Mon, 13 Mar 2017 15:06:10 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/rest-api/rest-posts-controller.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php index 409982eed8..abc30d40ce 100644 --- a/tests/phpunit/tests/rest-api/rest-posts-controller.php +++ b/tests/phpunit/tests/rest-api/rest-posts-controller.php @@ -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() {