From 905efe4a74ab59a3af2f8f0616e395ee53e64fa9 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Tue, 12 Apr 2022 10:32:50 +0300 Subject: [PATCH] Update patterns REST controllers namespace to stable --- .../class-wp-rest-block-pattern-categories-controller.php | 2 +- .../wordpress-6.0/class-wp-rest-block-patterns-controller.php | 2 +- packages/core-data/src/resolvers.js | 4 ++-- ...class-wp-rest-block-pattern-categories-controller-test.php | 4 ++-- phpunit/class-wp-rest-block-patterns-controller-test.php | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/compat/wordpress-6.0/class-wp-rest-block-pattern-categories-controller.php b/lib/compat/wordpress-6.0/class-wp-rest-block-pattern-categories-controller.php index f3e5a779939a23..a54d3a1912d306 100644 --- a/lib/compat/wordpress-6.0/class-wp-rest-block-pattern-categories-controller.php +++ b/lib/compat/wordpress-6.0/class-wp-rest-block-pattern-categories-controller.php @@ -26,7 +26,7 @@ class WP_REST_Block_Pattern_Categories_Controller extends WP_REST_Controller { * @since 6.0.0 */ public function __construct() { - $this->namespace = '__experimental'; + $this->namespace = 'wp/v2'; $this->rest_base = 'block-patterns/categories'; } diff --git a/lib/compat/wordpress-6.0/class-wp-rest-block-patterns-controller.php b/lib/compat/wordpress-6.0/class-wp-rest-block-patterns-controller.php index fb5439a4167904..33d3076c1be51d 100644 --- a/lib/compat/wordpress-6.0/class-wp-rest-block-patterns-controller.php +++ b/lib/compat/wordpress-6.0/class-wp-rest-block-patterns-controller.php @@ -24,7 +24,7 @@ class WP_REST_Block_Patterns_Controller extends WP_REST_Controller { * Constructor. */ public function __construct() { - $this->namespace = '__experimental'; + $this->namespace = 'wp/v2'; $this->rest_base = 'block-patterns/patterns'; } diff --git a/packages/core-data/src/resolvers.js b/packages/core-data/src/resolvers.js index ad7b56befca3e9..481f63445efef0 100644 --- a/packages/core-data/src/resolvers.js +++ b/packages/core-data/src/resolvers.js @@ -456,14 +456,14 @@ export const __experimentalGetCurrentThemeGlobalStylesVariations = () => async ( export const getBlockPatterns = () => async ( { dispatch } ) => { const patterns = await apiFetch( { - path: '/__experimental/block-patterns/patterns', + path: '/wp/v2/block-patterns/patterns', } ); dispatch( { type: 'RECEIVE_BLOCK_PATTERNS', patterns } ); }; export const getBlockPatternCategories = () => async ( { dispatch } ) => { const categories = await apiFetch( { - path: '/__experimental/block-patterns/categories', + path: '/wp/v2/block-patterns/categories', } ); dispatch( { type: 'RECEIVE_BLOCK_PATTERN_CATEGORIES', categories } ); }; diff --git a/phpunit/class-wp-rest-block-pattern-categories-controller-test.php b/phpunit/class-wp-rest-block-pattern-categories-controller-test.php index 8f22b0eefad5bf..fc8702b32735a7 100644 --- a/phpunit/class-wp-rest-block-pattern-categories-controller-test.php +++ b/phpunit/class-wp-rest-block-pattern-categories-controller-test.php @@ -49,7 +49,7 @@ public static function wpTearDownAfterClass() { public function test_register_routes() { $routes = rest_get_server()->get_routes(); $this->assertArrayHasKey( - '/__experimental/block-patterns/categories', + '/wp/v2/block-patterns/categories', $routes, 'The categories route does not exist' ); @@ -61,7 +61,7 @@ public function test_get_items() { $expected_names = array( 'test', 'query' ); $expected_fields = array( 'name', 'label' ); - $request = new WP_REST_Request( 'GET', '/__experimental/block-patterns/categories' ); + $request = new WP_REST_Request( 'GET', '/wp/v2/block-patterns/categories' ); $request['_fields'] = 'name,label'; $response = rest_get_server()->dispatch( $request ); $data = $response->get_data(); diff --git a/phpunit/class-wp-rest-block-patterns-controller-test.php b/phpunit/class-wp-rest-block-patterns-controller-test.php index 6db9f1ca499624..43c91647aa6735 100644 --- a/phpunit/class-wp-rest-block-patterns-controller-test.php +++ b/phpunit/class-wp-rest-block-patterns-controller-test.php @@ -65,7 +65,7 @@ public static function wpTearDownAfterClass() { public function test_register_routes() { $routes = rest_get_server()->get_routes(); $this->assertArrayHasKey( - '/__experimental/block-patterns/patterns', + '/wp/v2/block-patterns/patterns', $routes, 'The patterns route does not exist' ); @@ -77,7 +77,7 @@ public function test_get_items() { $expected_names = array( 'test/one', 'test/two' ); $expected_fields = array( 'name', 'content' ); - $request = new WP_REST_Request( 'GET', '/__experimental/block-patterns/patterns' ); + $request = new WP_REST_Request( 'GET', '/wp/v2/block-patterns/patterns' ); $request['_fields'] = 'name,content'; $response = rest_get_server()->dispatch( $request ); $data = $response->get_data();