@@ -17,7 +17,7 @@ class Tests_Kses extends WP_UnitTestCase {
17
17
public function test_wp_filter_post_kses_address ( $ content , $ expected ) {
18
18
global $ allowedposttags ;
19
19
20
- $ this ->assertSame ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
20
+ $ this ->assertEqualHTML ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
21
21
}
22
22
23
23
/**
@@ -65,7 +65,7 @@ public function data_wp_filter_post_kses_address() {
65
65
public function test_wp_filter_post_kses_a ( $ content , $ expected ) {
66
66
global $ allowedposttags ;
67
67
68
- $ this ->assertSame ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
68
+ $ this ->assertEqualHTML ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
69
69
}
70
70
71
71
/**
@@ -120,7 +120,7 @@ public function data_wp_filter_post_kses_a() {
120
120
* @param string $expected Expected output following KSES parsing.
121
121
*/
122
122
public function test_wp_kses_video ( $ source , $ context , $ expected ) {
123
- $ this ->assertSame ( $ expected , wp_kses ( $ source , $ context ) );
123
+ $ this ->assertEqualHTML ( $ expected , wp_kses ( $ source , $ context ) );
124
124
}
125
125
126
126
/**
@@ -171,7 +171,7 @@ public function data_wp_kses_video() {
171
171
public function test_wp_filter_post_kses_abbr ( $ content , $ expected ) {
172
172
global $ allowedposttags ;
173
173
174
- $ this ->assertSame ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
174
+ $ this ->assertEqualHTML ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
175
175
}
176
176
177
177
/**
@@ -232,7 +232,7 @@ public function test_feed_links() {
232
232
<a href="">CLICK ME</a>
233
233
EOF ;
234
234
235
- $ this ->assertSame ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
235
+ $ this ->assertEqualHTML ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
236
236
}
237
237
238
238
public function test_wp_kses_bad_protocol () {
@@ -546,8 +546,8 @@ public function test_hyphenated_tag() {
546
546
$ expect_stripped_content = 'Alot of hyphens. ' ;
547
547
$ expect_valid_content = '<hyphenated-tag attribute="value">Alot of hyphens.</hyphenated-tag> ' ;
548
548
549
- $ this ->assertSame ( $ expect_stripped_content , wp_kses_post ( $ content ) );
550
- $ this ->assertSame ( $ expect_valid_content , wp_kses ( $ content , $ custom_tags ) );
549
+ $ this ->assertEqualHTML ( $ expect_stripped_content , wp_kses_post ( $ content ) );
550
+ $ this ->assertEqualHTML ( $ expect_valid_content , wp_kses ( $ content , $ custom_tags ) );
551
551
}
552
552
553
553
/**
@@ -613,7 +613,7 @@ public static function data_normalize_entities(): array {
613
613
* @dataProvider data_normalize_entities
614
614
*/
615
615
public function test_wp_kses_normalize_entities ( string $ input , string $ expected ) {
616
- $ this ->assertSame ( $ expected , wp_kses_normalize_entities ( $ input ) );
616
+ $ this ->assertEqualHTML ( $ expected , wp_kses_normalize_entities ( $ input ) );
617
617
}
618
618
619
619
/**
@@ -625,7 +625,7 @@ public function test_wp_kses_normalize_entities( string $input, string $expected
625
625
public function test_ctrl_removal ( $ content , $ expected ) {
626
626
global $ allowedposttags ;
627
627
628
- return $ this ->assertSame ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
628
+ return $ this ->assertEqualHTML ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
629
629
}
630
630
631
631
public function data_ctrl_removal () {
@@ -662,7 +662,7 @@ public function data_ctrl_removal() {
662
662
public function test_slash_zero_removal ( $ content , $ expected ) {
663
663
global $ allowedposttags ;
664
664
665
- return $ this ->assertSame ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
665
+ return $ this ->assertEqualHTML ( $ expected , wp_kses ( $ content , $ allowedposttags ) );
666
666
}
667
667
668
668
public function data_slash_zero_removal () {
@@ -917,7 +917,7 @@ public function test_bdo_tag_allowed() {
917
917
918
918
$ content = '<p>This is <bdo dir="rtl">a BDO tag</bdo>. Weird, <bdo dir="ltr">right?</bdo></p> ' ;
919
919
920
- $ this ->assertSame ( $ content , wp_kses ( $ content , $ allowedposttags ) );
920
+ $ this ->assertEqualHTML ( $ content , wp_kses ( $ content , $ allowedposttags ) );
921
921
}
922
922
923
923
/**
@@ -928,7 +928,7 @@ public function test_ruby_tag_allowed() {
928
928
929
929
$ content = '<ruby>✶<rp>: </rp><rt>Star</rt><rp>, </rp><rt lang="fr">Étoile</rt><rp>.</rp></ruby> ' ;
930
930
931
- $ this ->assertSame ( $ content , wp_kses ( $ content , $ allowedposttags ) );
931
+ $ this ->assertEqualHTML ( $ content , wp_kses ( $ content , $ allowedposttags ) );
932
932
}
933
933
934
934
/**
@@ -939,7 +939,7 @@ public function test_ol_reversed_attribute_allowed() {
939
939
940
940
$ content = '<ol reversed="reversed"><li>Item 1</li><li>Item 2</li><li>Item 3</li></ol> ' ;
941
941
942
- $ this ->assertSame ( $ content , wp_kses ( $ content , $ allowedposttags ) );
942
+ $ this ->assertEqualHTML ( $ content , wp_kses ( $ content , $ allowedposttags ) );
943
943
}
944
944
945
945
/**
@@ -949,7 +949,7 @@ public function test_wp_kses_attr_no_attributes_allowed_with_empty_array() {
949
949
$ element = 'foo ' ;
950
950
$ attribute = 'title="foo" class="bar" ' ;
951
951
952
- $ this ->assertSame ( "< {$ element }> " , wp_kses_attr ( $ element , $ attribute , array ( 'foo ' => array () ), array () ) );
952
+ $ this ->assertEqualHTML ( "< {$ element }> " , wp_kses_attr ( $ element , $ attribute , array ( 'foo ' => array () ), array () ) );
953
953
}
954
954
955
955
/**
@@ -959,7 +959,7 @@ public function test_wp_kses_attr_no_attributes_allowed_with_true() {
959
959
$ element = 'foo ' ;
960
960
$ attribute = 'title="foo" class="bar" ' ;
961
961
962
- $ this ->assertSame ( "< {$ element }> " , wp_kses_attr ( $ element , $ attribute , array ( 'foo ' => true ), array () ) );
962
+ $ this ->assertEqualHTML ( "< {$ element }> " , wp_kses_attr ( $ element , $ attribute , array ( 'foo ' => true ), array () ) );
963
963
}
964
964
965
965
/**
@@ -969,7 +969,7 @@ public function test_wp_kses_attr_single_attribute_is_allowed() {
969
969
$ element = 'foo ' ;
970
970
$ attribute = 'title="foo" class="bar" ' ;
971
971
972
- $ this ->assertSame ( "< {$ element } title= \"foo \"> " , wp_kses_attr ( $ element , $ attribute , array ( 'foo ' => array ( 'title ' => true ) ), array () ) );
972
+ $ this ->assertEqualHTML ( "< {$ element } title= \"foo \"> " , wp_kses_attr ( $ element , $ attribute , array ( 'foo ' => array ( 'title ' => true ) ), array () ) );
973
973
}
974
974
975
975
/**
@@ -979,7 +979,7 @@ public function test_wp_kses_attr_no_attributes_allowed_with_false() {
979
979
$ element = 'foo ' ;
980
980
$ attribute = 'title="foo" class="bar" ' ;
981
981
982
- $ this ->assertSame ( "< {$ element }> " , wp_kses_attr ( $ element , $ attribute , array ( 'foo ' => false ), array () ) );
982
+ $ this ->assertEqualHTML ( "< {$ element }> " , wp_kses_attr ( $ element , $ attribute , array ( 'foo ' => false ), array () ) );
983
983
}
984
984
985
985
/**
@@ -1423,7 +1423,7 @@ public function test_wp_kses_attr_data_attribute_is_allowed() {
1423
1423
$ test = '<div data-foo="foo" data-bar="bar" datainvalid="gone" data-two-hyphens="remains">Pens and pencils</div> ' ;
1424
1424
$ expected = '<div data-foo="foo" data-bar="bar" data-two-hyphens="remains">Pens and pencils</div> ' ;
1425
1425
1426
- $ this ->assertSame ( $ expected , wp_kses_post ( $ test ) );
1426
+ $ this ->assertEqualHTML ( $ expected , wp_kses_post ( $ test ) );
1427
1427
}
1428
1428
1429
1429
/**
@@ -1435,7 +1435,7 @@ public function test_wp_kses_attr_data_attribute_hypens_allowed() {
1435
1435
$ test = '<div data--leading="remains" data-trailing-="remains" data-middle--double="remains">Pens and pencils</div> ' ;
1436
1436
$ expected = '<div data--leading="remains" data-trailing-="remains" data-middle--double="remains">Pens and pencils</div> ' ;
1437
1437
1438
- $ this ->assertSame ( $ expected , wp_kses_post ( $ test ) );
1438
+ $ this ->assertEqualHTML ( $ expected , wp_kses_post ( $ test ) );
1439
1439
}
1440
1440
1441
1441
/**
@@ -1456,7 +1456,7 @@ public function test_wildcard_requires_hyphen_after_prefix() {
1456
1456
1457
1457
$ actual = wp_kses ( $ content , $ allowed_html );
1458
1458
1459
- $ this ->assertSame ( $ expected , $ actual );
1459
+ $ this ->assertEqualHTML ( $ expected , $ actual );
1460
1460
}
1461
1461
1462
1462
/**
@@ -1476,7 +1476,7 @@ public function test_wildcard_allows_two_hyphens() {
1476
1476
1477
1477
$ actual = wp_kses ( $ content , $ allowed_html );
1478
1478
1479
- $ this ->assertSame ( $ expected , $ actual );
1479
+ $ this ->assertEqualHTML ( $ expected , $ actual );
1480
1480
}
1481
1481
1482
1482
/**
@@ -1761,7 +1761,7 @@ public function test_wp_kses_img_tag_standard_attributes() {
1761
1761
1762
1762
$ html = implode ( ' ' , $ html );
1763
1763
1764
- $ this ->assertSame ( $ html , wp_kses_post ( $ html ) );
1764
+ $ this ->assertEqualHTML ( $ html , wp_kses_post ( $ html ) );
1765
1765
}
1766
1766
1767
1767
/**
@@ -1779,7 +1779,7 @@ public function test_wp_kses_main_tag_standard_attributes() {
1779
1779
1780
1780
$ html = implode ( ' ' , $ test );
1781
1781
1782
- $ this ->assertSame ( $ html , wp_kses_post ( $ html ) );
1782
+ $ this ->assertEqualHTML ( $ html , wp_kses_post ( $ html ) );
1783
1783
}
1784
1784
1785
1785
/**
@@ -1793,7 +1793,7 @@ public function test_wp_kses_main_tag_standard_attributes() {
1793
1793
* @param string $expected The expected result from KSES.
1794
1794
*/
1795
1795
public function test_wp_kses_object_tag_allowed ( $ html , $ expected ) {
1796
- $ this ->assertSame ( $ expected , wp_kses_post ( $ html ) );
1796
+ $ this ->assertEqualHTML ( $ expected , wp_kses_post ( $ html ) );
1797
1797
}
1798
1798
1799
1799
/**
@@ -1904,7 +1904,7 @@ public function data_wp_kses_object_tag_allowed() {
1904
1904
*/
1905
1905
public function test_wp_kses_object_data_url_with_port_number_allowed ( $ html , $ expected ) {
1906
1906
add_filter ( 'upload_dir ' , array ( $ this , 'wp_kses_upload_dir_filter ' ), 10 , 2 );
1907
- $ this ->assertSame ( $ expected , wp_kses_post ( $ html ) );
1907
+ $ this ->assertEqualHTML ( $ expected , wp_kses_post ( $ html ) );
1908
1908
}
1909
1909
1910
1910
/**
@@ -1970,7 +1970,7 @@ public function test_wp_kses_object_added_in_html_filter() {
1970
1970
1971
1971
remove_filter ( 'wp_kses_allowed_html ' , array ( $ this , 'filter_wp_kses_object_added_in_html_filter ' ) );
1972
1972
1973
- $ this ->assertSame ( $ html , $ filtered_html );
1973
+ $ this ->assertEqualHTML ( $ html , $ filtered_html );
1974
1974
}
1975
1975
1976
1976
public function filter_wp_kses_object_added_in_html_filter ( $ tags , $ context ) {
@@ -2001,7 +2001,7 @@ public function filter_wp_kses_object_added_in_html_filter( $tags, $context ) {
2001
2001
* @param string $expected_output How `wp_kses()` ought to transform the comment.
2002
2002
*/
2003
2003
public function test_wp_kses_preserves_html_comments ( $ html_comment , $ expected_output ) {
2004
- $ this ->assertSame (
2004
+ $ this ->assertEqualHTML (
2005
2005
$ expected_output ,
2006
2006
wp_kses ( $ html_comment , array () ),
2007
2007
'Failed to properly preserve HTML comment. '
@@ -2033,7 +2033,7 @@ public static function data_html_containing_various_kinds_of_html_comments() {
2033
2033
* @param array $allowed_html The allowed HTML to pass to KSES.
2034
2034
*/
2035
2035
public function test_wp_kses_allowed_values_list ( $ content , $ expected , $ allowed_html ) {
2036
- $ this ->assertSame ( $ expected , wp_kses ( $ content , $ allowed_html ) );
2036
+ $ this ->assertEqualHTML ( $ expected , wp_kses ( $ content , $ allowed_html ) );
2037
2037
}
2038
2038
2039
2039
/**
@@ -2091,7 +2091,7 @@ static function ( $datum ) {
2091
2091
* @param array $allowed_html The allowed HTML to pass to KSES.
2092
2092
*/
2093
2093
public function test_wp_kses_required_attribute ( $ content , $ expected , $ allowed_html ) {
2094
- $ this ->assertSame ( $ expected , wp_kses ( $ content , $ allowed_html ) );
2094
+ $ this ->assertEqualHTML ( $ expected , wp_kses ( $ content , $ allowed_html ) );
2095
2095
}
2096
2096
2097
2097
/**
@@ -2312,7 +2312,7 @@ public function data_kses_globals_are_defined() {
2312
2312
public function test_target_attribute_preserved_in_context ( $ context , $ input , $ expected ) {
2313
2313
$ allowed = wp_kses_allowed_html ( $ context );
2314
2314
$ this ->assertTrue ( isset ( $ allowed ['a ' ]['target ' ] ), "Target attribute not allowed in {$ context }" );
2315
- $ this ->assertEquals ( $ expected , wp_kses ( $ input , $ context ) );
2315
+ $ this ->assertEqualHTML ( $ expected , wp_kses ( $ input , $ context ) );
2316
2316
}
2317
2317
2318
2318
/**
0 commit comments