Make WordPress Core


Ignore:
Timestamp:
02/16/2017 08:08:23 PM (8 years ago)
Author:
jnylen0
Message:

REST API: Cast revision author ID to int.

The post_author field is a string internally, but we need to cast it to an integer in the REST API. This was already done for posts, but not for revisions. The field is already declared as an integer in both controllers.

Fixes #39871.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-revisions-controller.php

    r39126 r40063  
    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
     
    137139        $data = $response->get_data();
    138140        $this->assertEqualSets( $fields, array_keys( $data ) );
     141        $this->assertSame( self::$editor_id, $data['author'] );
    139142    }
    140143
Note: See TracChangeset for help on using the changeset viewer.