Changeset 40601
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
r40063 r40601 339 339 */ 340 340 public function prepare_item_for_response( $post, $request ) { 341 $GLOBALS['post'] = $post; 342 343 setup_postdata( $post ); 341 344 342 345 $schema = $this->get_item_schema(); -
trunk/tests/phpunit/tests/rest-api/rest-revisions-controller.php
r40063 r40601 336 336 } 337 337 338 public function test_get_item_sets_up_postdata() { 339 wp_set_current_user( self::$editor_id ); 340 $request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . self::$post_id . '/revisions/' . $this->revision_id1 ); 341 $this->server->dispatch( $request ); 342 343 $post = get_post(); 344 $parent_post_id = wp_is_post_revision( $post->ID ); 345 346 $this->assertEquals( $post->ID, $this->revision_id1 ); 347 $this->assertEquals( $parent_post_id, self::$post_id ); 348 } 349 338 350 }
Note: See TracChangeset
for help on using the changeset viewer.