- Timestamp:
- 01/31/2024 10:39:04 AM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-global-styles-revisions-controller.php
r56714 r57494 227 227 /** 228 228 * @ticket 58524 229 * @ticket 59810 229 230 * 230 231 * @covers WP_REST_Global_Styles_Controller::register_routes … … 236 237 $routes, 237 238 'Global style revisions based on the given parentID route does not exist.' 239 ); 240 $this->assertArrayHasKey( 241 '/wp/v2/global-styles/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)', 242 $routes, 243 'Single global style revisions based on the given parentID and revision ID route does not exist.' 238 244 ); 239 245 } … … 303 309 $this->assertSame( $this->revision_1_id, $data[2]['id'] ); 304 310 $this->check_get_revision_response( $data[2], $this->revision_1 ); 311 } 312 313 /** 314 * @ticket 59810 315 * 316 * @covers WP_REST_Global_Styles_Controller::get_item 317 */ 318 public function test_get_item() { 319 wp_set_current_user( self::$admin_id ); 320 321 $request = new WP_REST_Request( 'GET', '/wp/v2/global-styles/' . self::$global_styles_id . '/revisions/' . $this->revision_1_id ); 322 $response = rest_get_server()->dispatch( $request ); 323 $data = $response->get_data(); 324 325 $this->assertSame( 200, $response->get_status(), 'Response status is 200.' ); 326 $this->check_get_revision_response( $data, $this->revision_1 ); 327 } 328 329 /** 330 * @ticket 59810 331 * 332 * @covers WP_REST_Global_Styles_Controller::get_revision 333 */ 334 public function test_get_item_invalid_revision_id_should_error() { 335 wp_set_current_user( self::$admin_id ); 336 337 $expected_error = 'rest_post_invalid_id'; 338 $expected_status = 404; 339 $request = new WP_REST_Request( 'GET', '/wp/v2/global-styles/' . self::$global_styles_id . '/revisions/20000001' ); 340 $response = rest_get_server()->dispatch( $request ); 341 342 $this->assertErrorResponse( $expected_error, $response, $expected_status ); 305 343 } 306 344 … … 798 836 * @doesNotPerformAssertions 799 837 */ 800 public function test_get_item() {801 // Controller does not implement get_item().802 }803 804 /**805 * @doesNotPerformAssertions806 */807 838 public function test_create_item() { 808 839 // Controller does not implement create_item().
Note: See TracChangeset
for help on using the changeset viewer.