Make WordPress Core


Ignore:
Timestamp:
12/14/2021 04:12:57 PM (3 years ago)
Author:
hellofromTonya
Message:

Themes: Rename public static functions in WP_Theme_JSON_Resolver to remove custom_post_type references.

WordPress Core is not really custom and does not reference "custom post type" in its function naming. This commit renames 2 public static methods:

  • WP_Theme_JSON_Resolver::get_user_custom_post_type_id() renamed to WP_Theme_JSON_Resolver::get_user_global_styles_post_id().
  • WP_Theme_JSON_Resolver::get_user_data_from_custom_post_type() renamed to WP_Theme_JSON_Resolver:: get_user_data_from_wp_global_styles().

Follow-up to [52049], [52051], [52069], [52232], [52275], [52364].

Props antonvlasenko, bernhard-reiter, costdev, desrosj, hellofromTonya, noisysocks, oandregal, SergeyBiryukov.
Fixes #54517.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php

    r52275 r52372  
    322322    }
    323323
    324     function test_get_user_data_from_custom_post_type_does_not_use_uncached_queries() {
     324    function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries() {
    325325        add_filter( 'query', array( $this, 'filter_db_query' ) );
    326326        $query_count = count( $this->queries );
    327327        for ( $i = 0; $i < 3; $i++ ) {
    328             WP_Theme_JSON_Resolver::get_user_data_from_custom_post_type( wp_get_theme() );
     328            WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( wp_get_theme() );
    329329            WP_Theme_JSON_Resolver::clean_cached_data();
    330330        }
    331331        $query_count = count( $this->queries ) - $query_count;
    332         $this->assertEquals( 1, $query_count, 'Only one SQL query should be peformed for multiple invocations of WP_Theme_JSON_Resolver::get_user_data_from_custom_post_type()' );
    333 
    334         $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_custom_post_type( wp_get_theme() );
     332        $this->assertEquals( 1, $query_count, 'Only one SQL query should be peformed for multiple invocations of WP_Theme_JSON_Resolver::get_global_styles_from_post()' );
     333
     334        $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( wp_get_theme() );
    335335        $this->assertEmpty( $user_cpt );
    336336
    337         $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_custom_post_type( wp_get_theme(), true );
     337        $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( wp_get_theme(), true );
    338338        $this->assertNotEmpty( $user_cpt );
    339339
    340340        $query_count = count( $this->queries );
    341341        for ( $i = 0; $i < 3; $i++ ) {
    342             WP_Theme_JSON_Resolver::get_user_data_from_custom_post_type( wp_get_theme() );
     342            WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( wp_get_theme() );
    343343            WP_Theme_JSON_Resolver::clean_cached_data();
    344344        }
Note: See TracChangeset for help on using the changeset viewer.