Make WordPress Core

Ticket #39871: 39871.diff

File 39871.diff, 1.7 KB (added by jnylen0, 8 years ago)
  • src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
    index c38bd45..d3f665d 100644
    a b class WP_REST_Revisions_Controller extends WP_REST_Controller { 
    344344                $data = array();
    345345
    346346                if ( ! empty( $schema['properties']['author'] ) ) {
    347                         $data['author'] = $post->post_author;
     347                        $data['author'] = (int) $post->post_author;
    348348                }
    349349
    350350                if ( ! empty( $schema['properties']['date'] ) ) {
  • tests/phpunit/tests/rest-api/rest-revisions-controller.php

    diff --git a/tests/phpunit/tests/rest-api/rest-revisions-controller.php b/tests/phpunit/tests/rest-api/rest-revisions-controller.php
    index 3c88c6f..4557004 100644
    a b class WP_Test_REST_Revisions_Controller extends WP_Test_REST_Controller_Testcase 
    2727                        'role' => 'contributor',
    2828                ) );
    2929
     30                wp_set_current_user( self::$editor_id );
    3031                wp_update_post( array( 'post_content' => 'This content is better.', 'ID' => self::$post_id ) );
    3132                wp_update_post( array( 'post_content' => 'This content is marvelous.', 'ID' => self::$post_id ) );
     33                wp_set_current_user( 0 );
    3234        }
    3335
    3436        public static function wpTearDownAfterClass() {
    class WP_Test_REST_Revisions_Controller extends WP_Test_REST_Controller_Testcase 
    136138                );
    137139                $data = $response->get_data();
    138140                $this->assertEqualSets( $fields, array_keys( $data ) );
     141                $this->assertSame( self::$editor_id, $data['author'] );
    139142        }
    140143
    141144        public function test_get_item_embed_context() {