From 00b7a548b59ada85397eca312ee222616b252088 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Wed, 10 Nov 2021 13:20:16 +1100 Subject: [PATCH] Fix .wp-env.json to WP 5.8.1 (#36333) * Fix .wp-env.json to WP 5.8 Try fixing .wp-env.json to the 5.8 branch as a temporary fix for Gutenberg CI. This should unblock Gutenberg developers while the plugin is made compatible with WordPress trunk. * Pin to 5.8.1 to fix majority of unit test failures * Pin to specific sha that fixed php unit tests * Try a different sha * Try pinning to 5.8.1 and skipping failing test that requires 5.9 * Fix linting issue * Update merges child theme JSON test to use Gutenberg class instead of core WP_Theme_JSON_Resolver class Co-authored-by: Glen Davies Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> --- .wp-env.json | 2 +- phpunit/class-block-fixture-test.php | 4 ++++ phpunit/class-wp-theme-json-resolver-test.php | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.wp-env.json b/.wp-env.json index a684b91dfb76c..f7721cfe733bd 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,5 +1,5 @@ { - "core": "WordPress/WordPress", + "core": "WordPress/WordPress#5.8.1", "plugins": [ "." ], "themes": [ "WordPress/theme-experiments/tt1-blocks#tt1-blocks@0.4.7" ], "env": { diff --git a/phpunit/class-block-fixture-test.php b/phpunit/class-block-fixture-test.php index 94e5c17c66ac3..8cf0f8937728a 100644 --- a/phpunit/class-block-fixture-test.php +++ b/phpunit/class-block-fixture-test.php @@ -14,6 +14,10 @@ class Block_Fixture_Test extends WP_UnitTestCase { * @dataProvider data_block_fixtures */ function test_kses_doesnt_change_fixtures( $block, $filename ) { + // Skip this test while Gutenberg is pinned to WordPress 5.8.1. + // Once WordPress 5.9 is released, this test can be re-enabled. + // See: https://github.com/WordPress/gutenberg/pull/35611. + $this->markTestSkipped( 'This test requires WordPress 5.9. See: https://core.trac.wordpress.org/ticket/54261' ); // KSES doesn't allow data: URLs, so we need to replace any of them in fixtures. $block = preg_replace( "/src=['\"]data:[^'\"]+['\"]/", 'src="https://wordpress.org/foo.jpg"', $block ); diff --git a/phpunit/class-wp-theme-json-resolver-test.php b/phpunit/class-wp-theme-json-resolver-test.php index 2f4eb6e36c106..289a940ace3c2 100644 --- a/phpunit/class-wp-theme-json-resolver-test.php +++ b/phpunit/class-wp-theme-json-resolver-test.php @@ -177,7 +177,7 @@ private static function recursive_ksort( &$array ) { function test_merges_child_theme_json_into_parent_theme_json() { switch_theme( 'block-theme-child' ); - $actual_settings = WP_Theme_JSON_Resolver::get_theme_data()->get_settings(); + $actual_settings = WP_Theme_JSON_Resolver_Gutenberg::get_theme_data()->get_settings(); $expected_settings = array( 'color' => array( 'custom' => false, @@ -250,7 +250,7 @@ function test_merges_child_theme_json_into_parent_theme_json() { ); $this->assertSame( - WP_Theme_JSON_Resolver::get_theme_data()->get_custom_templates(), + WP_Theme_JSON_Resolver_Gutenberg::get_theme_data()->get_custom_templates(), array( 'page-home' => array( 'title' => 'Homepage',