Changeset 52372 for trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php
- Timestamp:
- 12/14/2021 04:12:57 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php
r52275 r52372 322 322 } 323 323 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() { 325 325 add_filter( 'query', array( $this, 'filter_db_query' ) ); 326 326 $query_count = count( $this->queries ); 327 327 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() ); 329 329 WP_Theme_JSON_Resolver::clean_cached_data(); 330 330 } 331 331 $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() ); 335 335 $this->assertEmpty( $user_cpt ); 336 336 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 ); 338 338 $this->assertNotEmpty( $user_cpt ); 339 339 340 340 $query_count = count( $this->queries ); 341 341 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() ); 343 343 WP_Theme_JSON_Resolver::clean_cached_data(); 344 344 }
Note: See TracChangeset
for help on using the changeset viewer.