diff --git a/tests/phpunit/tests/theme/wpThemeJsonResolver.php b/tests/phpunit/tests/theme/wpThemeJsonResolver.php index 5174b04a9f8b2..d648ba867de86 100644 --- a/tests/phpunit/tests/theme/wpThemeJsonResolver.php +++ b/tests/phpunit/tests/theme/wpThemeJsonResolver.php @@ -693,4 +693,28 @@ function test_get_user_data_from_wp_global_styles_filter_state() { $this->assertIsArray( $post2 ); $this->assertSameSets( array(), $post2 ); } + + + /** + * @ticket 56835 + * @covers WP_Theme_JSON_Resolver::get_theme_data + */ + function test_get_theme_data_theme_supports_overrides_theme_json() { + // Test that get_theme_data() returns a WP_Theme_JSON object. + $theme_json_resolver = new WP_Theme_JSON_Resolver(); + $theme_data = $theme_json_resolver->get_theme_data(); + $this->assertInstanceOf( 'WP_Theme_JSON', $theme_data ); + + // Test that wp_theme_json_data_theme filter has been called. + $this->assertGreaterThan( 0, did_filter( 'wp_theme_json_data_default' ) ); + + // Test that data from theme.json must be backfilled from existing theme supports. + $previous_settings = $theme_data->get_settings(); + $previous_line_height = $previous_settings['typography']['lineHeight']; + $this->assertFalse( $previous_line_height ); + add_theme_support( 'custom-line-height' ); + $current_settings = $theme_json_resolver->get_theme_data()->get_settings(); + $line_height = $current_settings['typography']['lineHeight']; + $this->assertTrue( $line_height ); + } }