@@ -550,19 +550,70 @@ public function test_hyphenated_tag() {
550550 $ this ->assertSame ( $ expect_valid_content , wp_kses ( $ content , $ custom_tags ) );
551551 }
552552
553+ /**
554+ * Data provider.
555+ */
556+ public static function data_normalize_entities (): array {
557+ return array (
558+ /**
559+ * These examples are from the wp_kses_normalize_entities function description.
560+ */
561+ 'AT&T ' => array ( 'AT&T ' , 'AT&T ' ),
562+ ': ' => array ( ': ' , ': ' ),
563+ '&#XYZZY; ' => array ( '&#XYZZY; ' , '&#XYZZY; ' ),
564+
565+ 'Named ref & ' => array ( '♠ ' , '♠ ' ),
566+ 'Named ref & ' => array ( '♠ ' , '♠ ' ),
567+ 'Named ref ♠ ' => array ( '♠ ' , '♠ ' ),
568+ 'Named ref ¹ ' => array ( '¹ ' , '¹ ' ),
569+ 'Named ref ² ' => array ( '² ' , '² ' ),
570+ 'Named ref ³ ' => array ( '³ ' , '³ ' ),
571+ 'Named ref ¼ ' => array ( '¼ ' , '¼ ' ),
572+ 'Named ref ½ ' => array ( '½ ' , '½ ' ),
573+ 'Named ref ¾ ' => array ( '¾ ' , '¾ ' ),
574+ 'Named ref ∴ ' => array ( '∴ ' , '∴ ' ),
575+
576+ 'Decimal ref 	 ( ) ' => array ( '	 ' , '	 ' ),
577+ 'Decimal ref " (") ' => array ( '" ' , '" ' ),
578+ 'Decimal ref " (") ' => array ( '" ' , '" ' ),
579+ 'Decimal ref & (&) ' => array ( '& ' , '& ' ),
580+ "Decimal ref ' (') " => array ( '' ' , '' ' ),
581+ 'Decimal ref 😍 (😍) ' => array ( '😍 ' , '😍 ' ),
582+ 'Decimal ref 😍 (😍) ' => array ( '😍 ' , '😍 ' ),
583+
584+ 'Hex ref 	 ( ) ' => array ( '	 ' , '	 ' ),
585+ 'Hex ref " (") ' => array ( '" ' , '" ' ),
586+ 'Hex ref " (") ' => array ( '" ' , '" ' ),
587+ 'Hex ref & (&) ' => array ( '& ' , '& ' ),
588+ "Hex ref ' (') " => array ( '' ' , '' ' ),
589+ 'Hex ref 😍 (😍) ' => array ( '😍 ' , '😍 ' ),
590+ 'Hex ref 😍 (😍) ' => array ( '😍 ' , '😍 ' ),
591+
592+ 'HEX REF " (") ' => array ( '" ' , '" ' ),
593+ 'HEX REF & (&) ' => array ( '& ' , '& ' ),
594+ "HEX REF ' (') " => array ( '' ' , '' ' ),
595+ 'HEX REF 😍 (😍) ' => array ( '😍 ' , '😍 ' ),
596+
597+ 'Encoded named ref & ' => array ( '& ' , '& ' ),
598+ 'Encoded named ref & ' => array ( '& ' , '& ' ),
599+ 'Encoded named ref & ' => array ( '& ' , '& ' ),
600+
601+ /*
602+ * The codepoint value here is outside of the valid unicode range whose
603+ * maximum is 0x10FFFF or 1114111.
604+ */
605+ 'Invalid decimal unicode � ' => array ( '� ' , '� ' ),
606+ 'Invalid hex unicode � ' => array ( '� ' , '� ' ),
607+ );
608+ }
609+
553610 /**
554611 * @ticket 26290
612+ *
613+ * @dataProvider data_normalize_entities
555614 */
556- public function test_wp_kses_normalize_entities () {
557- $ this ->assertSame ( '♠ ' , wp_kses_normalize_entities ( '♠ ' ) );
558-
559- $ this ->assertSame ( '¹ ' , wp_kses_normalize_entities ( '¹ ' ) );
560- $ this ->assertSame ( '² ' , wp_kses_normalize_entities ( '² ' ) );
561- $ this ->assertSame ( '³ ' , wp_kses_normalize_entities ( '³ ' ) );
562- $ this ->assertSame ( '¼ ' , wp_kses_normalize_entities ( '¼ ' ) );
563- $ this ->assertSame ( '½ ' , wp_kses_normalize_entities ( '½ ' ) );
564- $ this ->assertSame ( '¾ ' , wp_kses_normalize_entities ( '¾ ' ) );
565- $ this ->assertSame ( '∴ ' , wp_kses_normalize_entities ( '∴ ' ) );
615+ public function test_wp_kses_normalize_entities ( string $ input , string $ expected ) {
616+ $ this ->assertSame ( $ expected , wp_kses_normalize_entities ( $ input ) );
566617 }
567618
568619 /**
0 commit comments