',
+ 'before_section' => '
',
'after_section' => '
',
),
array(
'id' => 'test-section',
'title' => 'Section title',
'callback' => '__return_false',
- 'before_section' => '
',
+ 'before_section' => '
',
'after_section' => '
',
'section_class' => '',
),
@@ -367,14 +367,14 @@ public function data_extra_args_for_add_settings_section() {
'disallowed tag in after_section' => array(
array(
'before_section' => '
',
- 'after_section' => '
',
+ 'after_section' => '
',
),
array(
'id' => 'test-section',
'title' => 'Section title',
'callback' => '__return_false',
'before_section' => '
',
- 'after_section' => '
',
+ 'after_section' => '
',
diff --git a/tests/phpunit/tests/block-bindings/postMetaSource.php b/tests/phpunit/tests/block-bindings/postMetaSource.php
index 555376e1c6b0c..353e11a2a8e52 100644
--- a/tests/phpunit/tests/block-bindings/postMetaSource.php
+++ b/tests/phpunit/tests/block-bindings/postMetaSource.php
@@ -260,8 +260,8 @@ public function test_custom_field_with_unsafe_html_is_sanitized() {
$content = $this->get_modified_post_content( '
Fallback value
' );
- $this->assertSame(
- '
alert(“Unsafe HTML”)
',
+ $this->assertEqualHTML(
+ '
',
$content,
'The post content should not include the script tag.'
);
diff --git a/tests/phpunit/tests/block-bindings/render.php b/tests/phpunit/tests/block-bindings/render.php
index 3ce1993e4c351..08875a450f979 100644
--- a/tests/phpunit/tests/block-bindings/render.php
+++ b/tests/phpunit/tests/block-bindings/render.php
@@ -193,7 +193,7 @@ function ( $source_args, $block_instance, $attribute_name ) {
function () {
return '';
},
- '
alert("Unsafe HTML")
',
+ '
',
),
'symbols and numbers should be rendered correctly' => array(
function () {
@@ -234,7 +234,7 @@ public function test_different_get_value_callbacks( $get_value_callback, $expect
$block = new WP_Block( $parsed_blocks[0] );
$result = $block->render();
- $this->assertSame(
+ $this->assertEqualHTML(
$expected,
trim( $result ),
'The block content should be updated with the value returned by the source.'
diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php
index 6937fcd4b2c1e..ce4991a29ae7d 100644
--- a/tests/phpunit/tests/customize/manager.php
+++ b/tests/phpunit/tests/customize/manager.php
@@ -1357,11 +1357,11 @@ public function test_save_changeset_post_without_kses_corrupting_json() {
// User saved as one who cannot bypass content_save_pre filter.
$this->assertStringNotContainsString( '' ) );
+ $this->assertSame( 'Unfiltered', apply_filters( 'content_save_pre', 'Unfiltered' ) );
wp_publish_post( $changeset_post_id ); // @todo If wp_update_post() is used here, then kses will corrupt the post_content.
$this->assertSame( 'Unfiltered', get_option( 'scratchpad' ) );
}
diff --git a/tests/phpunit/tests/customize/nav-menu-item-setting.php b/tests/phpunit/tests/customize/nav-menu-item-setting.php
index 0c832f3c6887c..df255d622880c 100644
--- a/tests/phpunit/tests/customize/nav-menu-item-setting.php
+++ b/tests/phpunit/tests/customize/nav-menu-item-setting.php
@@ -588,11 +588,11 @@ public function test_sanitize() {
'menu_item_parent' => 0,
'position' => -123,
'type' => 'customb',
- 'title' => current_user_can( 'unfiltered_html' ) ? '\o/ o\'o Hi' : '\o/ o\'o HiunfilteredHtml()',
+ 'title' => current_user_can( 'unfiltered_html' ) ? '\o/ o\'o Hi' : '\o/ o\'o Hi',
'url' => '',
'target' => 'onclick',
- 'attr_title' => current_user_can( 'unfiltered_html' ) ? '\o/ o\'o
bolded' : '\o/ o\'o
boldedunfilteredHtml()',
- 'description' => current_user_can( 'unfiltered_html' ) ? '\o/ o\'o
Hello world' : '\o/ o\'o
Hello worldunfilteredHtml()',
+ 'attr_title' => current_user_can( 'unfiltered_html' ) ? '\o/ o\'o
bolded' : '\o/ o\'o
bolded',
+ 'description' => current_user_can( 'unfiltered_html' ) ? '\o/ o\'o
Hello world' : '\o/ o\'o
Hello world',
'classes' => 'hello inject',
'xfn' => 'hello inject',
'status' => 'draft',
diff --git a/tests/phpunit/tests/formatting/sanitizeTextField.php b/tests/phpunit/tests/formatting/sanitizeTextField.php
index 579f8e29de74e..664301ac8d6cd 100644
--- a/tests/phpunit/tests/formatting/sanitizeTextField.php
+++ b/tests/phpunit/tests/formatting/sanitizeTextField.php
@@ -20,7 +20,7 @@ public function test_sanitize_text_field( $str, $expected ) {
$expected_oneline = $expected;
$expected_multiline = $expected;
}
- $this->assertSame( $expected_oneline, sanitize_text_field( $str ) );
+ $this->assertEqualHTML( $expected_oneline, sanitize_text_field( $str ) );
$this->assertSameIgnoreEOL( $expected_multiline, sanitize_textarea_field( $str ) );
}
@@ -55,7 +55,7 @@ public function data_sanitize_text_field() {
array(
"foo <\ndiv\n> bar",
array(
- 'oneline' => 'foo < div > bar',
+ 'oneline' => 'foo < div > bar',
'multiline' => "foo <\ndiv\n> bar",
),
),
diff --git a/tests/phpunit/tests/functions/wpTriggerError.php b/tests/phpunit/tests/functions/wpTriggerError.php
index b642b7b08f6ae..6d577cc294fc8 100644
--- a/tests/phpunit/tests/functions/wpTriggerError.php
+++ b/tests/phpunit/tests/functions/wpTriggerError.php
@@ -110,7 +110,7 @@ public function data_should_trigger_error() {
'disallowed HTML elements are present in message' => array(
'function_name' => 'some_function',
'message' => '',
- 'expected_message' => 'some_function(): alert("expected the function name and message")',
+ 'expected_message' => 'some_function(): ',
),
);
}
diff --git a/tests/phpunit/tests/html-api/wpHtmlTagProcessorModifiableText.php b/tests/phpunit/tests/html-api/wpHtmlTagProcessorModifiableText.php
index 589318daf3a70..5a0d7426de062 100644
--- a/tests/phpunit/tests/html-api/wpHtmlTagProcessorModifiableText.php
+++ b/tests/phpunit/tests/html-api/wpHtmlTagProcessorModifiableText.php
@@ -414,7 +414,7 @@ public function test_updates_basic_modifiable_text_on_supported_nodes( string $h
'Should have modified the text at the target node.'
);
- $this->assertSame(
+ $this->assertEqualHTML(
$transformed,
$processor->get_updated_html(),
"Should have transformed the HTML as expected when modifying the target node's modifiable text."
diff --git a/tests/phpunit/tests/icons/wpRestIconsController.php b/tests/phpunit/tests/icons/wpRestIconsController.php
index dc899ce2bd7be..dbe8c7270b263 100644
--- a/tests/phpunit/tests/icons/wpRestIconsController.php
+++ b/tests/phpunit/tests/icons/wpRestIconsController.php
@@ -333,11 +333,11 @@ public function test_get_item_returns_specific_icon() {
$this->assertSame( 'core/arrow-left', $data['name'] );
$this->assertSame( 'Arrow Left', $data['label'] );
$this->assertNotEmpty( $data['content'] );
- $this->assertStringStartsWith(
- '