From a3069a64412115f840bddff0243e65a1c8ba6f2b Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Tue, 13 Aug 2024 18:57:50 +0530 Subject: [PATCH 1/3] Check PHP 8.3 error --- tests/phpunit/tests/html-api/wpHtmlTagProcessor.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php b/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php index b9c6817988032..c73092c4a7400 100644 --- a/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php +++ b/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php @@ -2914,4 +2914,15 @@ public function test_unclosed_funky_comment_input_too_short() { $this->assertFalse( $processor->next_tag() ); $this->assertTrue( $processor->paused_at_incomplete_token() ); } + + public function test_next_tag_issue_php83() { + $picture_markup = '

Green Leaves

'; + $picture_processor = new WP_HTML_Tag_Processor( $picture_markup ); + $this->assertFalse( $picture_processor->next_tag( array( 'tag_name' => 'PICTURE' ) ), 'There should not be a PICTURE tag.' ); + + $picture_processor = new WP_HTML_Tag_Processor( $picture_markup ); + $picture_processor->next_tag( array( 'tag_name' => 'IMG' ) ); + $this->assertStringEndsWith( '.webp', $picture_processor->get_attribute( 'src' ), 'Make sure the IMG should return WEBP src.' ); + $this->assertSame( $img_markup, $picture_markup, 'Make sure the IMG and Picture markup are same.' ); + } } From 349ae8bbdf7c4893243169a154301e6c06e791a8 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Tue, 13 Aug 2024 18:58:58 +0530 Subject: [PATCH 2/3] Remove --- tests/phpunit/tests/html-api/wpHtmlTagProcessor.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php b/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php index c73092c4a7400..5d466b9c71a21 100644 --- a/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php +++ b/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php @@ -2923,6 +2923,5 @@ public function test_next_tag_issue_php83() { $picture_processor = new WP_HTML_Tag_Processor( $picture_markup ); $picture_processor->next_tag( array( 'tag_name' => 'IMG' ) ); $this->assertStringEndsWith( '.webp', $picture_processor->get_attribute( 'src' ), 'Make sure the IMG should return WEBP src.' ); - $this->assertSame( $img_markup, $picture_markup, 'Make sure the IMG and Picture markup are same.' ); } } From d98ab3ba116e81fc1039742fef7c473c145c5cf2 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Tue, 13 Aug 2024 19:00:59 +0530 Subject: [PATCH 3/3] Update tests/phpunit/tests/html-api/wpHtmlTagProcessor.php --- tests/phpunit/tests/html-api/wpHtmlTagProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php b/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php index 5d466b9c71a21..8c22ce1fa00c4 100644 --- a/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php +++ b/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php @@ -2915,7 +2915,7 @@ public function test_unclosed_funky_comment_input_too_short() { $this->assertTrue( $processor->paused_at_incomplete_token() ); } - public function test_next_tag_issue_php83() { + public function test_next_tag_issue_for_trunk_and_php83() { $picture_markup = '

Green Leaves

'; $picture_processor = new WP_HTML_Tag_Processor( $picture_markup ); $this->assertFalse( $picture_processor->next_tag( array( 'tag_name' => 'PICTURE' ) ), 'There should not be a PICTURE tag.' );