From 2d1d007827aa9aa8651cd379811b6fc0b8024887 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 10 Oct 2025 14:54:37 +0800 Subject: [PATCH 1/5] Fix unit test HTML escaping after core change --- phpunit/block-supports/background-test.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpunit/block-supports/background-test.php b/phpunit/block-supports/background-test.php index dace3b4dabc762..e7d8255cc8a7e2 100644 --- a/phpunit/block-supports/background-test.php +++ b/phpunit/block-supports/background-test.php @@ -133,7 +133,7 @@ public function data_background_block_support() { 'url' => 'https://example.com/image.jpg', ), ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is applied when backgroundImage is a string' => array( @@ -145,7 +145,7 @@ public function data_background_block_support() { 'background_style' => array( 'backgroundImage' => "url('https://example.com/image.jpg')", ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style with contain, position, attachment, and repeat is applied' => array( @@ -162,7 +162,7 @@ public function data_background_block_support() { 'backgroundSize' => 'contain', 'backgroundAttachment' => 'fixed', ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is appended if a style attribute already exists' => array( @@ -176,7 +176,7 @@ public function data_background_block_support() { 'url' => 'https://example.com/image.jpg', ), ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is appended if a style attribute containing multiple styles already exists' => array( @@ -190,7 +190,7 @@ public function data_background_block_support() { 'url' => 'https://example.com/image.jpg', ), ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is not applied if the block does not support background image' => array( From f9274af0fee91d99de9ac4e2afaeb28d529334ed Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 10 Oct 2025 15:18:40 +0800 Subject: [PATCH 2/5] Huh? --- phpunit/block-supports/background-test.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpunit/block-supports/background-test.php b/phpunit/block-supports/background-test.php index e7d8255cc8a7e2..dace3b4dabc762 100644 --- a/phpunit/block-supports/background-test.php +++ b/phpunit/block-supports/background-test.php @@ -133,7 +133,7 @@ public function data_background_block_support() { 'url' => 'https://example.com/image.jpg', ), ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is applied when backgroundImage is a string' => array( @@ -145,7 +145,7 @@ public function data_background_block_support() { 'background_style' => array( 'backgroundImage' => "url('https://example.com/image.jpg')", ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style with contain, position, attachment, and repeat is applied' => array( @@ -162,7 +162,7 @@ public function data_background_block_support() { 'backgroundSize' => 'contain', 'backgroundAttachment' => 'fixed', ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is appended if a style attribute already exists' => array( @@ -176,7 +176,7 @@ public function data_background_block_support() { 'url' => 'https://example.com/image.jpg', ), ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is appended if a style attribute containing multiple styles already exists' => array( @@ -190,7 +190,7 @@ public function data_background_block_support() { 'url' => 'https://example.com/image.jpg', ), ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is not applied if the block does not support background image' => array( From f600b47ae0acdaf72fcde63db461884bd3dfa34b Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 10 Oct 2025 15:29:44 +0800 Subject: [PATCH 3/5] Revert "Huh?" This reverts commit f9274af0fee91d99de9ac4e2afaeb28d529334ed. --- phpunit/block-supports/background-test.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpunit/block-supports/background-test.php b/phpunit/block-supports/background-test.php index dace3b4dabc762..e7d8255cc8a7e2 100644 --- a/phpunit/block-supports/background-test.php +++ b/phpunit/block-supports/background-test.php @@ -133,7 +133,7 @@ public function data_background_block_support() { 'url' => 'https://example.com/image.jpg', ), ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is applied when backgroundImage is a string' => array( @@ -145,7 +145,7 @@ public function data_background_block_support() { 'background_style' => array( 'backgroundImage' => "url('https://example.com/image.jpg')", ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style with contain, position, attachment, and repeat is applied' => array( @@ -162,7 +162,7 @@ public function data_background_block_support() { 'backgroundSize' => 'contain', 'backgroundAttachment' => 'fixed', ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is appended if a style attribute already exists' => array( @@ -176,7 +176,7 @@ public function data_background_block_support() { 'url' => 'https://example.com/image.jpg', ), ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is appended if a style attribute containing multiple styles already exists' => array( @@ -190,7 +190,7 @@ public function data_background_block_support() { 'url' => 'https://example.com/image.jpg', ), ), - 'expected_wrapper' => '
Content
', + 'expected_wrapper' => '
Content
', 'wrapper' => '
Content
', ), 'background image style is not applied if the block does not support background image' => array( From 510f0b13ba284fdd16fd46c5aecaca11dcd955f0 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 10 Oct 2025 15:54:49 +0800 Subject: [PATCH 4/5] Use assertEqualHTML --- phpunit/block-supports/background-test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit/block-supports/background-test.php b/phpunit/block-supports/background-test.php index e7d8255cc8a7e2..947aafd6b0667a 100644 --- a/phpunit/block-supports/background-test.php +++ b/phpunit/block-supports/background-test.php @@ -108,7 +108,7 @@ public function test_background_block_support( $theme_name, $block_name, $backgr $actual = gutenberg_render_background_support( $wrapper, $block ); - $this->assertEquals( + $this->assertEqualHTML( $expected_wrapper, $actual, 'Background block wrapper markup should be correct' From 0c23b030bcfaa70547f2fd40c1c26a4de6a7182c Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 10 Oct 2025 16:04:28 +0800 Subject: [PATCH 5/5] Switch to assertSame to match core test --- phpunit/block-supports/background-test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit/block-supports/background-test.php b/phpunit/block-supports/background-test.php index 947aafd6b0667a..dcacbc333b6553 100644 --- a/phpunit/block-supports/background-test.php +++ b/phpunit/block-supports/background-test.php @@ -108,7 +108,7 @@ public function test_background_block_support( $theme_name, $block_name, $backgr $actual = gutenberg_render_background_support( $wrapper, $block ); - $this->assertEqualHTML( + $this->assertSame( $expected_wrapper, $actual, 'Background block wrapper markup should be correct'