Changeset 61473 for trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php
- Timestamp:
- 01/12/2026 12:18:12 PM (5 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php
r60729 r61473 735 735 * @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles 736 736 */ 737 public function test_get_user_data_from_wp_global_styles_ does_not_run_for_theme_without_support() {738 // The 'default' theme does not support theme.json .737 public function test_get_user_data_from_wp_global_styles_runs_for_classic_themes() { 738 // The 'default' theme does not support theme.json (classic theme). 739 739 switch_theme( 'default' ); 740 740 wp_set_current_user( self::$administrator_id ); 741 741 $theme = wp_get_theme(); 742 742 743 $start_queries = get_num_queries(); 744 745 // When theme.json is not supported, the method should not run a query and always return an empty result. 746 $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme ); 747 $this->assertEmpty( $user_cpt, 'User CPT is expected to be empty.' ); 748 $this->assertSame( 0, get_num_queries() - $start_queries, 'Unexpected SQL query detected for theme without theme.json support.' ); 749 743 // Classic themes should now be able to access user global styles data. 744 // When should_create_post is true, it should create a post. 750 745 $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme, true ); 751 $this->assertEmpty( $user_cpt, 'User CPT is expected to be empty.' ); 752 $this->assertSame( 0, get_num_queries() - $start_queries, 'Unexpected SQL query detected for theme without theme.json support.' ); 746 $this->assertIsArray( $user_cpt, 'User CPT should be an array for classic themes.' ); 747 $this->assertArrayHasKey( 'ID', $user_cpt, 'User CPT should have an ID for classic themes.' ); 748 749 // Clean up the created post. 750 if ( isset( $user_cpt['ID'] ) ) { 751 wp_delete_post( $user_cpt['ID'], true ); 752 } 753 753 } 754 754
Note: See TracChangeset
for help on using the changeset viewer.