Skip to content

Commit

Permalink
Replace fallbacks to fallback (singular) (#50044)
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave authored Apr 26, 2023
1 parent 0824845 commit af42480
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class WP_REST_Navigation_Fallback_Controller extends WP_REST_Controller {
*/
public function __construct() {
$this->namespace = 'wp-block-editor/v1';
$this->rest_base = 'navigation-fallbacks';
$this->rest_base = 'navigation-fallback';
$this->post_type = 'wp_navigation';
}

Expand Down Expand Up @@ -121,7 +121,7 @@ public function get_item_schema() {

$this->schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'navigation-fallbacks',
'title' => 'navigation-fallback',
'type' => 'object',
'properties' => array(
'id' => array(
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function Navigation( {
return;
}

apiFetch( { path: '/wp-block-editor/v1/navigation-fallbacks' } )
apiFetch( { path: '/wp-block-editor/v1/navigation-fallback' } )
.then( ( fallbackNavigationMenu ) => {
if ( ! fallbackNavigationMenu?.id ) {
showNavigationMenuStatusNotice(
Expand Down
10 changes: 5 additions & 5 deletions phpunit/class-wp-rest-navigation-fallback-controller-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function set_up() {
public function test_register_routes() {
$routes = rest_get_server()->get_routes();

$this->assertArrayHasKey( '/wp-block-editor/v1/navigation-fallbacks', $routes, 'Fallback route should be registered.' );
$this->assertArrayHasKey( '/wp-block-editor/v1/navigation-fallback', $routes, 'Fallback route should be registered.' );
}

/**
Expand All @@ -53,7 +53,7 @@ public function test_should_not_return_menus_for_users_without_permissions() {

wp_set_current_user( self::$editor_user );

$request = new WP_REST_Request( 'GET', '/wp-block-editor/v1/navigation-fallbacks' );
$request = new WP_REST_Request( 'GET', '/wp-block-editor/v1/navigation-fallback' );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();

Expand All @@ -71,7 +71,7 @@ public function test_should_not_return_menus_for_users_without_permissions() {
*/
public function test_get_item() {

$request = new WP_REST_Request( 'GET', '/wp-block-editor/v1/navigation-fallbacks' );
$request = new WP_REST_Request( 'GET', '/wp-block-editor/v1/navigation-fallback' );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();

Expand All @@ -96,7 +96,7 @@ public function test_get_item() {
* @since 6.3.0 Added Navigation Fallbacks endpoint.
*/
public function test_get_item_schema() {
$request = new WP_REST_Request( 'OPTIONS', '/wp-block-editor/v1/navigation-fallbacks' );
$request = new WP_REST_Request( 'OPTIONS', '/wp-block-editor/v1/navigation-fallback' );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();

Expand All @@ -119,7 +119,7 @@ public function test_get_item_schema() {
* @since 6.3.0 Added Navigation Fallbacks endpoint.
*/
public function test_adds_links() {
$request = new WP_REST_Request( 'GET', '/wp-block-editor/v1/navigation-fallbacks' );
$request = new WP_REST_Request( 'GET', '/wp-block-editor/v1/navigation-fallback' );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();

Expand Down

0 comments on commit af42480

Please sign in to comment.