Changeset 56105
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
r56082 r56105 436 436 437 437 if ( post_type_supports( $this->post_type, 'revisions' ) ) { 438 $revisions = wp_get_latest_revision_id_and_total_count( $id );439 $revisions_count = ! is_wp_error( $revisions ) ? $revisions['count'] : 0;440 $revisions_base = sprintf( '/%s/%d/revisions', $base, $id );438 $revisions = wp_get_latest_revision_id_and_total_count( $id ); 439 $revisions_count = ! is_wp_error( $revisions ) ? $revisions['count'] : 0; 440 $revisions_base = sprintf( '/%s/%d/revisions', $base, $id ); 441 441 $links['version-history'] = array( 442 442 'href' => rest_url( $revisions_base ), -
trunk/tests/phpunit/tests/rest-api/rest-global-styles-revisions-controller.php
r56082 r56105 66 66 */ 67 67 private $revision_3_id; 68 69 68 70 69 /** … … 226 225 } 227 226 228 229 /** 227 /** 228 * @ticket 58524 229 * 230 230 * @covers WP_REST_Global_Styles_Controller::register_routes 231 *232 * @ticket 58524233 231 */ 234 232 public function test_register_routes() { … … 242 240 243 241 /** 244 * @ covers WP_REST_Global_Styles_Controller::get_items245 * 246 * @ ticket 58524242 * @ticket 58524 243 * 244 * @covers WP_REST_Global_Styles_Controller::get_items 247 245 */ 248 246 public function test_get_items_missing_parent() { … … 282 280 283 281 /** 284 * @ covers WP_REST_Global_Styles_Controller::get_items285 * 286 * @ ticket 58524282 * @ticket 58524 283 * 284 * @covers WP_REST_Global_Styles_Controller::get_items 287 285 */ 288 286 public function test_get_items() { … … 308 306 309 307 /** 310 * @ covers WP_REST_Global_Styles_Controller::get_items311 * 312 * @ ticket 58524308 * @ticket 58524 309 * 310 * @covers WP_REST_Global_Styles_Controller::get_items 313 311 */ 314 312 public function test_get_items_eligible_roles() { … … 340 338 341 339 /** 340 * @ticket 58524 341 * 342 342 * @covers WP_REST_Global_Styles_Controller::get_items with context arg. 343 *344 * @ticket 58524345 343 */ 346 344 public function test_get_item_embed_context() { … … 361 359 362 360 /** 361 * @ticket 58524 362 * 363 363 * @covers WP_REST_Global_Styles_Controller::get_item_schema 364 *365 * @ticket 58524366 364 */ 367 365 public function test_get_item_schema() { … … 384 382 385 383 /** 384 * @ticket 58524 385 * 386 386 * @covers WP_REST_Global_Styles_Controller::get_item_permissions_check 387 *388 * @ticket 58524389 387 */ 390 388 public function test_get_item_permissions_check() { … … 402 400 * 403 401 * @ticket 58524 402 * 403 * @covers WP_REST_Global_Styles_Controller::get_items 404 404 */ 405 405 public function test_get_items_pagination_header_of_the_first_page() { … … 439 439 * 440 440 * @ticket 58524 441 * 442 * @covers WP_REST_Global_Styles_Controller::get_items 441 443 */ 442 444 public function test_get_items_pagination_header_of_the_last_page() { … … 475 477 * 476 478 * @ticket 58524 479 * 480 * @covers WP_REST_Global_Styles_Controller::get_items 477 481 */ 478 482 public function test_get_items_invalid_per_page_should_error() { … … 495 499 * 496 500 * @ticket 58524 501 * 502 * @covers WP_REST_Global_Styles_Controller::get_items 497 503 */ 498 504 public function test_get_items_out_of_bounds_page_should_error() { … … 522 528 * 523 529 * @ticket 58524 530 * 531 * @covers WP_REST_Global_Styles_Controller::get_items 524 532 */ 525 533 public function test_get_items_invalid_max_pages_should_error() { … … 548 556 * 549 557 * @ticket 58524 558 * 559 * @covers WP_REST_Global_Styles_Controller::get_items 550 560 */ 551 561 public function test_get_items_default_query_should_fetch_all_revisons() { … … 559 569 } 560 570 561 562 571 /** 563 572 * Tests that 'offset' query shouldn't work without 'per_page' (fallback -1). … … 566 575 * 567 576 * @ticket 58524 577 * 578 * @covers WP_REST_Global_Styles_Controller::get_items 568 579 */ 569 580 public function test_get_items_offset_should_not_work_without_per_page() { … … 585 596 * 586 597 * @ticket 58524 598 * 599 * @covers WP_REST_Global_Styles_Controller::get_items 587 600 */ 588 601 public function test_get_items_offset_should_work_with_per_page() { … … 610 623 * 611 624 * @ticket 58524 625 * 626 * @covers WP_REST_Global_Styles_Controller::get_items 612 627 */ 613 628 public function test_get_items_offset_should_take_priority_over_page() { … … 637 652 * 638 653 * @ticket 58524 654 * 655 * @covers WP_REST_Global_Styles_Controller::get_items 639 656 */ 640 657 public function test_get_items_total_revisions_offset_should_return_empty_data() { … … 663 680 * 664 681 * @ticket 58524 682 * 683 * @covers WP_REST_Global_Styles_Controller::get_items 665 684 */ 666 685 public function test_get_items_out_of_bound_offset_should_error() { … … 689 708 * 690 709 * @ticket 58524 710 * 711 * @covers WP_REST_Global_Styles_Controller::get_items 691 712 */ 692 713 public function test_get_items_impossible_high_number_offset_should_error() { … … 715 736 * 716 737 * @ticket 58524 738 * 739 * @covers WP_REST_Global_Styles_Controller::get_items 717 740 */ 718 741 public function test_get_items_invalid_offset_should_error() { … … 742 765 * 743 766 * @ticket 58524 767 * 768 * @covers WP_REST_Global_Styles_Controller::get_items 744 769 */ 745 770 public function test_get_items_out_of_bounds_page_should_not_error_if_offset() {
Note: See TracChangeset
for help on using the changeset viewer.