- Timestamp:
- 03/02/2025 10:05:08 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/wpRestTemplateAutosavesController.php
r59605 r59899 34 34 */ 35 35 const TEMPLATE_PART_POST_TYPE = 'wp_template_part'; 36 37 /** 38 * @var string 39 */ 40 const PARENT_POST_TYPE = 'wp_template'; 36 41 37 42 /** … … 294 299 295 300 /** 301 * @ticket 56481 302 */ 303 public function test_get_items_should_return_no_response_body_for_head_requests() { 304 wp_set_current_user( self::$admin_id ); 305 $autosave_post_id = wp_create_post_autosave( 306 array( 307 'post_content' => 'Autosave content.', 308 'post_ID' => self::$template_post->ID, 309 'post_type' => self::PARENT_POST_TYPE, 310 ) 311 ); 312 313 $request = new WP_REST_Request( 314 'HEAD', 315 '/wp/v2/templates/' . self::TEST_THEME . '/' . self::TEMPLATE_NAME . '/autosaves' 316 ); 317 $response = rest_get_server()->dispatch( $request ); 318 $this->assertSame( 200, $response->get_status(), 'Response status is 200.' ); 319 $this->assertNull( $response->get_data(), 'The server should not generate a body in response to a HEAD request.' ); 320 } 321 322 /** 296 323 * Data provider for test_get_items_with_data_provider. 297 324 * … … 425 452 ) 426 453 ); 454 } 455 456 /** 457 * @ticket 56481 458 */ 459 public function test_get_item_should_return_no_response_body_for_head_requests() { 460 wp_set_current_user( self::$admin_id ); 461 462 $autosave_post_id = wp_create_post_autosave( 463 array( 464 'post_content' => 'Autosave content.', 465 'post_ID' => self::$template_post->ID, 466 'post_type' => self::PARENT_POST_TYPE, 467 ) 468 ); 469 470 $request = new WP_REST_Request( 'HEAD', '/wp/v2/templates/' . self::TEST_THEME . '/' . self::TEMPLATE_NAME . '/autosaves/' . $autosave_post_id ); 471 $response = rest_get_server()->dispatch( $request ); 472 $this->assertSame( 200, $response->get_status(), 'Response status is 200.' ); 473 $this->assertNull( $response->get_data(), 'The server should not generate a body in response to a HEAD request.' ); 427 474 } 428 475
Note: See TracChangeset
for help on using the changeset viewer.