- Timestamp:
- 05/02/2018 01:24:30 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r42972 r43087 1498 1498 1499 1499 $this->check_get_post_response( $response, 'edit' ); 1500 } 1501 1502 public function test_prepare_item_limit_fields() { 1503 wp_set_current_user( self::$editor_id ); 1504 $endpoint = new WP_REST_Posts_Controller( 'post' ); 1505 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); 1506 $request->set_param( 'context', 'edit' ); 1507 $request->set_param( '_fields', 'id,slug' ); 1508 $obj = get_post( self::$post_id ); 1509 $response = $endpoint->prepare_item_for_response( $obj, $request ); 1510 $this->assertEquals( array( 1511 'id', 1512 'slug', 1513 ), array_keys( $response->get_data() ) ); 1500 1514 } 1501 1515
Note: See TracChangeset
for help on using the changeset viewer.