From e0fea7b3d43a4391d0b21f05fbca0969ea702205 Mon Sep 17 00:00:00 2001 From: Ella Date: Mon, 17 Jun 2024 13:27:33 +0200 Subject: [PATCH 1/2] Try adding bogus comment test --- tests/phpunit/tests/kses.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php index 36bf2baf123d3..a5642c33843d2 100644 --- a/tests/phpunit/tests/kses.php +++ b/tests/phpunit/tests/kses.php @@ -1955,8 +1955,9 @@ public function wp_kses_preserves_html_comments( $html_comment, $expected_output */ public static function data_html_containing_various_kinds_of_html_comments() { return array( - 'Normative HTML comment' => array( 'beforeafter', 'beforeafter' ), - 'Closing tag with invalid tag name' => array( 'beforeafter', 'beforeafter' ), + 'Normative HTML comment' => array( 'beforeafter', 'beforeafter' ), + 'Closing tag with invalid tag name' => array( 'beforeafter', 'beforeafter' ), + 'Incorrectly opened comment (Markup declaration)' => array( 'beforeafter', 'beforeafter' ), ); } From bad1c1ee38e93f385f75a53fcabb6c4c363013ef Mon Sep 17 00:00:00 2001 From: Ella Date: Mon, 17 Jun 2024 13:36:52 +0200 Subject: [PATCH 2/2] Correct test function --- tests/phpunit/tests/kses.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php index a5642c33843d2..ea65a89092c07 100644 --- a/tests/phpunit/tests/kses.php +++ b/tests/phpunit/tests/kses.php @@ -1936,11 +1936,13 @@ public function filter_wp_kses_object_added_in_html_filter( $tags, $context ) { * * @ticket 61009 * + * @dataProvider data_html_containing_various_kinds_of_html_comments + * * @param string $html_comment HTML containing a comment; must not be a valid comment * but must be syntax which a browser interprets as a comment. * @param string $expected_output How `wp_kses()` ought to transform the comment. */ - public function wp_kses_preserves_html_comments( $html_comment, $expected_output ) { + public function test_wp_kses_preserves_html_comments( $html_comment, $expected_output ) { $this->assertSame( $expected_output, wp_kses( $html_comment, array() ), @@ -1955,8 +1957,8 @@ public function wp_kses_preserves_html_comments( $html_comment, $expected_output */ public static function data_html_containing_various_kinds_of_html_comments() { return array( - 'Normative HTML comment' => array( 'beforeafter', 'beforeafter' ), - 'Closing tag with invalid tag name' => array( 'beforeafter', 'beforeafter' ), + 'Normative HTML comment' => array( 'beforeafter', 'beforeafter' ), + 'Closing tag with invalid tag name' => array( 'beforeafter', 'beforeafter' ), 'Incorrectly opened comment (Markup declaration)' => array( 'beforeafter', 'beforeafter' ), ); }