wordpress-develop/tests/phpunit/tests/rest-api
Jonny Harris 1f51e1f4f6 REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers.
The Template and Template Part REST API controllers have unique characteristics compared to other post type REST API controllers. They do not rely on integer IDs to reference objects; instead, they use a combination of the theme name and slug of the template, like 'twentytwentyfour//home.' Consequently, when the post types template and template part were introduced in [52062], it led to the registration of REST API endpoints for autosaves and revisions with invalid URL structures.

In this commit, we introduce new functionality to enable custom autosave and revisions endpoints to be registered at the post type level. Similar to the 'rest_controller_class' parameter, developers can now define 'revisions_rest_controller' and 'autosave_rest_controller.' This empowers developers to create custom controllers for these functionalities. Additionally, we introduce a 'late_route_registration' parameter, which proves helpful when dealing with custom URL patterns and regex pattern matching issues.
This commit registers new classes for template and template part autosave and revisions controllers, differentiating them from standard controllers in the following ways:
* The response shape now matches that of the template controller.
* Permission checks align with the template controller.
* A custom URL pattern is introduced to support slug-based identification of templates.

Furthermore, we've updated the utility function '_build_block_template_result_from_post' to support passing revision post objects. This enhancement ensures compatibility with the custom revisions controller.

Props spacedmonkey, revgeorge, andraganescu, hellofromTonya, antonvlasenko, kadamwhite, ironprogrammer, costdev, mukesh27, timothyblynjacobs, adamsilverstein. 
Fixes 56922.

git-svn-id: https://develop.svn.wordpress.org/trunk@56819 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 14:03:03 +00:00
..
json_schema_test_suite REST API: Add support for the oneOf and anyOf keywords. 2020-10-20 18:22:39 +00:00
application-passwords.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
rest-application-passwords-controller.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
rest-attachments-controller.php Coding Standards: Use pre-increment/decrement for stand-alone statements. 2023-09-09 09:26:01 +00:00
rest-autosaves-controller.php Revisions: slash meta values for autosave (preview) revisions. 2023-09-29 15:05:40 +00:00
rest-block-directory-controller.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
rest-block-renderer-controller.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
rest-block-type-controller.php Blocks: Implement automatic block insertion into Block Hooks. 2023-09-21 16:16:05 +00:00
rest-blocks-controller.php Editor: rename sync_status and move it to top level. 2023-07-07 07:27:53 +00:00
rest-categories-controller.php Tests: Reduce usage of assertEquals 2023-09-29 15:22:12 +00:00
rest-comments-controller.php Coding Standards: Use pre-increment/decrement for stand-alone statements. 2023-09-09 09:26:01 +00:00
rest-controller.php Coding Standards: Remove superfluous blank lines at the end of various functions. 2023-09-08 10:01:14 +00:00
rest-global-styles-controller.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
rest-global-styles-revisions-controller.php Revisions: framework for storing post meta revisions. 2023-09-26 15:30:34 +00:00
rest-navigation-fallback-controller.php Editor: Move wp_navigation schema updating to WP_Navigation_Fallback class. 2023-10-06 14:04:22 +00:00
rest-pages-controller.php Coding Standards: Remove superfluous blank lines at the end of various classes. 2023-09-08 09:30:38 +00:00
rest-pattern-directory-controller.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
rest-plugins-controller.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
rest-post-meta-fields.php Revisions: slash meta values for autosave (preview) revisions. 2023-09-29 15:05:40 +00:00
rest-post-statuses-controller.php Coding Standards: Remove superfluous blank lines at the end of various classes. 2023-09-08 09:30:38 +00:00
rest-post-types-controller.php Tests: Reduce usage of assertEquals 2023-09-29 15:22:12 +00:00
rest-posts-controller.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
rest-request-validation.php Coding Standards: Remove superfluous blank lines at the end of various classes. 2023-09-08 09:30:38 +00:00
rest-request.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
rest-revisions-controller.php Revisions: framework for storing post meta revisions. 2023-09-26 15:30:34 +00:00
rest-schema-sanitization.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
rest-schema-setup.php REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers. 2023-10-10 14:03:03 +00:00
rest-schema-validation.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
rest-search-controller.php Coding Standards: Remove superfluous blank lines at the end of various classes. 2023-09-08 09:30:38 +00:00
rest-server.php REST API: Avoid unnecessarily preparing item links REST API index. 2023-09-13 14:32:33 +00:00
rest-settings-controller.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
rest-sidebars-controller.php Coding Standards: Use pre-increment/decrement for stand-alone statements. 2023-09-09 09:26:01 +00:00
rest-site-health-controller.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
rest-tags-controller.php Tests: Reduce usage of assertEquals 2023-09-29 15:22:12 +00:00
rest-taxonomies-controller.php Tests: Reduce usage of assertEquals 2023-09-29 15:22:12 +00:00
rest-term-meta-fields.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
rest-test-controller.php Coding Standards: Remove superfluous blank lines at the end of various classes. 2023-09-08 09:30:38 +00:00
rest-themes-controller.php REST API: Indicate when a theme supports the Site editor in the Themes REST API response. 2023-06-20 22:15:57 +00:00
rest-users-controller.php Coding Standards: Use pre-increment/decrement for stand-alone statements. 2023-09-09 09:26:01 +00:00
rest-widget-types-controller.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
rest-widgets-controller.php Coding Standards: Use pre-increment/decrement for stand-alone statements. 2023-09-09 09:26:01 +00:00
wpRestBlockPatternCategoriesController.php Tests: Correct uses of ReflectionProperty::setValue() for static properties. 2023-08-30 10:49:27 +00:00
wpRestBlockPatternsController.php Tests: Correct uses of ReflectionProperty::setValue() for static properties. 2023-08-30 10:49:27 +00:00
wpRestEditSiteExportController.php Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files. 2023-03-03 14:42:42 +00:00
wpRestMenuItemsController.php Tests: Reduce usage of assertEquals 2023-09-29 15:22:12 +00:00
wpRestMenuLocationsController.php Tests: Reduce usage of assertEquals 2023-09-29 15:22:12 +00:00
wpRestMenusController.php Tests: Reduce usage of assertEquals 2023-09-29 15:22:12 +00:00
wpRestTemplateAutosavesController.php REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers. 2023-10-10 14:03:03 +00:00
wpRestTemplateRevisionsController.php REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers. 2023-10-10 14:03:03 +00:00
wpRestTemplatesController.php Build/Test Tools: Update PHPUnit Polyfills to version 1.1.0. 2023-08-21 15:53:04 +00:00
wpRestUrlDetailsController.php Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00