- 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-taxonomies-controller.php
r42729 r43087 161 161 $response = $endpoint->prepare_item_for_response( $tax, $request ); 162 162 $this->check_taxonomy_object( 'edit', $tax, $response->get_data(), $response->get_links() ); 163 } 164 165 public function test_prepare_item_limit_fields() { 166 $tax = get_taxonomy( 'category' ); 167 $request = new WP_REST_Request; 168 $endpoint = new WP_REST_Taxonomies_Controller; 169 $request->set_param( 'context', 'edit' ); 170 $request->set_param( '_fields', 'id,name' ); 171 $response = $endpoint->prepare_item_for_response( $tax, $request ); 172 $this->assertEquals( array( 173 // 'id' doesn't exist in this context. 174 'name', 175 ), array_keys( $response->get_data() ) ); 163 176 } 164 177
Note: See TracChangeset
for help on using the changeset viewer.