- Timestamp:
- 03/11/2025 02:17:41 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php
r59899 r59970 168 168 169 169 $this->assertSame( 0, $filter->get_call_count(), 'The "' . $hook_name . '" filter was called when it should not be for HEAD requests.' ); 170 $this->assertNull( $response->get_data(), 'The server should not generate a body in response to a HEAD request.' ); 170 $this->assertSame( array(), $response->get_data(), 'The server should not generate a body in response to a HEAD request.' ); 171 } 172 173 /** 174 * @ticket 56481 175 */ 176 public function test_get_items_head_request_with_specified_fields_returns_success_response() { 177 wp_set_current_user( self::$contributor_id ); 178 self::mock_successful_response( 'browse-all', true ); 179 $request = new WP_REST_Request( 'HEAD', '/wp/v2/pattern-directory/patterns' ); 180 $request->set_param( '_fields', 'id' ); 181 $server = rest_get_server(); 182 $response = $server->dispatch( $request ); 183 add_filter( 'rest_post_dispatch', 'rest_filter_response_fields', 10, 3 ); 184 $response = apply_filters( 'rest_post_dispatch', $response, $server, $request ); 185 remove_filter( 'rest_post_dispatch', 'rest_filter_response_fields', 10 ); 186 187 $this->assertSame( 200, $response->get_status(), 'The response status should be 200.' ); 171 188 } 172 189
Note: See TracChangeset
for help on using the changeset viewer.