- 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-comments-controller.php
r42724 r43087 846 846 $data = $response->get_data(); 847 847 $this->check_comment_data( $data, 'edit', $response->get_links() ); 848 } 849 850 public function test_prepare_item_limit_fields() { 851 wp_set_current_user( self::$admin_id ); 852 $endpoint = new WP_REST_Comments_Controller; 853 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); 854 $request->set_param( 'context', 'edit' ); 855 $request->set_param( '_fields', 'id,status' ); 856 $obj = get_comment( self::$approved_id ); 857 $response = $endpoint->prepare_item_for_response( $obj, $request ); 858 $this->assertEquals( array( 859 'id', 860 'status', 861 ), array_keys( $response->get_data() ) ); 848 862 } 849 863
Note: See TracChangeset
for help on using the changeset viewer.