Make WordPress Core

Ticket #40136: 40136.3.diff

File 40136.3.diff, 2.0 KB (added by nerrad, 7 years ago)

refresh of patch for following WP coding standards re spacing

  • src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    index 7e3e5636c4..749d37a5d8 100644
    class WP_REST_Posts_Controller extends WP_REST_Controller { 
    13991399                        // #38883).  In this case, shim the value based on the `post_date`
    14001400                        // field with the site's timezone offset applied.
    14011401                        if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) {
    1402                                 $post_date_gmt = date( 'Y-m-d H:i:s', strtotime( $post->post_date ) - ( get_option( 'gmt_offset' ) * 3600 ) );
     1402                                $post_date_gmt = get_gmt_from_date( $post->post_date );
    14031403                        } else {
    14041404                                $post_date_gmt = $post->post_date_gmt;
    14051405                        }
  • tests/phpunit/tests/rest-api/rest-posts-controller.php

    diff --git tests/phpunit/tests/rest-api/rest-posts-controller.php tests/phpunit/tests/rest-api/rest-posts-controller.php
    index abc30d40ce..a25fa4acb9 100644
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    22372237
    22382238                $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
    22392239        }
    2240 
     2240       
    22412241        public function test_empty_post_date_gmt_shimmed_using_post_date() {
    22422242                global $wpdb;
    22432243
    22442244                wp_set_current_user( self::$editor_id );
    2245                 update_option( 'timezone_string', '' );
    2246                 update_option( 'gmt_offset', -6 );
     2245                update_option( 'timezone_string', 'America/Chicago' );
    22472246
    22482247                // Need to set dates using wpdb directly because `wp_update_post` and
    22492248                // `wp_insert_post` have additional validation on dates.
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    22882287                $this->assertEquals( $post->post_date_gmt, '2016-02-23 19:00:00' );
    22892288
    22902289                update_option( 'timezone_string', '' );
    2291                 update_option( 'gmt_offset', 0 );
    22922290        }
    22932291
    22942292        public function test_update_post_slug() {