Make WordPress Core


Ignore:
Timestamp:
02/28/2023 03:05:50 PM (20 months ago)
Author:
hellofromTonya
Message:

Editor: Deprecate _resolve_home_block_template().

The internal Core-only _resolve_home_block_template() function was introduced in [53093] for a specific purpose of resolving the template for a site's home page. It was used as part of the Site Editor's redirect when the postType and postId query args were missing. The server-side handling was removed in [55338]. The function is no longer used in Core.

This changeset deprecates the function and removes its tests.

Follow-up to [55338], [53093].

Props johnbillion, hellofromTonya.
Fixes #57716.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/block-template.php

    r54889 r55436  
    189189        $this->assertSame( '', $resolved_template_path );
    190190    }
    191 
    192     /**
    193      * Covers: https://github.com/WordPress/gutenberg/pull/38817.
    194      *
    195      * @ticket 55505
    196      */
    197     public function test_resolve_home_block_template_default_hierarchy() {
    198         $template = _resolve_home_block_template();
    199 
    200         $this->assertSame( 'wp_template', $template['postType'] );
    201         $this->assertSame( get_stylesheet() . '//index', $template['postId'] );
    202     }
    203 
    204     /**
    205      * @ticket 55505
    206      */
    207     public function test_resolve_home_block_template_static_homepage() {
    208         $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
    209         update_option( 'show_on_front', 'page' );
    210         update_option( 'page_on_front', $post_id );
    211 
    212         $template = _resolve_home_block_template();
    213 
    214         $this->assertSame( 'page', $template['postType'] );
    215         $this->assertSame( $post_id, $template['postId'] );
    216 
    217         delete_option( 'show_on_front', 'page' );
    218     }
    219 
    220     /**
    221      * @ticket 55505
    222      */
    223     public function test_resolve_home_block_template_no_resolution() {
    224         switch_theme( 'stylesheetonly' );
    225         $template = _resolve_home_block_template();
    226 
    227         $this->assertNull( $template );
    228     }
    229191}
Note: See TracChangeset for help on using the changeset viewer.