diff --git a/tests/phpunit/includes/build-visual-html-tree.php b/tests/phpunit/includes/build-visual-html-tree.php index ac31a0ac071db..5187ea960e1e1 100644 --- a/tests/phpunit/includes/build-visual-html-tree.php +++ b/tests/phpunit/includes/build-visual-html-tree.php @@ -202,7 +202,7 @@ static function ( $a, $b ) { case '#cdata-section': case '#text': $text_content = $processor->get_modifiable_text(); - if ( '' === trim( $text_content, " \f\t\r\n" ) ) { + if ( '' === $text_content ) { break; } $was_text = true; @@ -237,7 +237,7 @@ static function ( $a, $b ) { ++$indent_level; } - // If they're no attributes, we're done here. + // When no attributes are present, there’s nothing left to do. if ( empty( $block_attrs ) ) { break; } diff --git a/tests/phpunit/tests/block-template-utils.php b/tests/phpunit/tests/block-template-utils.php index b446ede299efa..d89aa35f06e72 100644 --- a/tests/phpunit/tests/block-template-utils.php +++ b/tests/phpunit/tests/block-template-utils.php @@ -306,10 +306,9 @@ public function data_remove_theme_attribute_in_block_template_content() { */ public function test_block_template_add_skip_link_inserts_link_and_adds_main_id_when_missing() { $template_html = '
Content
'; - $expected = ' - -
Content
- '; + $expected = + '' . + '
Content
'; $this->assertEqualHTML( $expected, _block_template_add_skip_link( $template_html ) ); } @@ -323,10 +322,9 @@ public function test_block_template_add_skip_link_inserts_link_and_adds_main_id_ */ public function test_block_template_add_skip_link_uses_existing_main_id() { $template_html = '
Content
'; - $expected = ' - -
Content
- '; + $expected = + '' . + '
Content
'; $this->assertEqualHTML( $expected, _block_template_add_skip_link( $template_html ) ); } @@ -340,10 +338,9 @@ public function test_block_template_add_skip_link_uses_existing_main_id() { */ public function test_block_template_add_skip_link_handles_boolean_main_id() { $template_html = '
Content
'; - $expected = ' - -
Content
- '; + $expected = + '' . + '
Content
'; $this->assertEqualHTML( $expected, _block_template_add_skip_link( $template_html ) ); } @@ -357,10 +354,9 @@ public function test_block_template_add_skip_link_handles_boolean_main_id() { */ public function test_block_template_add_skip_link_preserves_whitespace_main_id() { $template_html = '
Content
'; - $expected = ' - -
Content
- '; + $expected = + '' . + '
Content
'; $this->assertEqualHTML( $expected, _block_template_add_skip_link( $template_html ) ); } diff --git a/tests/phpunit/tests/blocks/wpBlock.php b/tests/phpunit/tests/blocks/wpBlock.php index f7c4710c9c3fe..ae067e7d79bbd 100644 --- a/tests/phpunit/tests/blocks/wpBlock.php +++ b/tests/phpunit/tests/blocks/wpBlock.php @@ -368,32 +368,39 @@ public function test_render_applies_dynamic_render_block_filter() { * @return array */ public function data_provider_test_render_enqueues_scripts_and_styles(): array { - $block_markup = ' - -
- -
First child
- - - -
Last child
- -
- - '; + $block_markup = <<<'HTML' + +
+ +
First child
+ + + +
Last child
+ +
+ +HTML; // TODO: Add case where a dynamic block renders other blocks? return array( 'all_printed' => array( 'set_up' => null, 'block_markup' => $block_markup, - 'expected_rendered_block' => ' -
-
First child
-

Hello World!

-
Last child
-
- ', + 'expected_rendered_block' => <<<'HTML' + +
+ +
First child
+ +

Hello World!

+ +
Last child
+ +
+ +HTML + , 'expected_styles' => array( 'static-view-style', 'static-child-view-style', 'dynamic-view-style' ), 'expected_scripts' => array( 'static-view-script', 'static-child-view-script', 'dynamic-view-script' ), 'expected_script_modules' => array( 'static-view-script-module', 'static-child-view-script-module', 'dynamic-view-script-module' ), @@ -414,13 +421,20 @@ static function ( $content ) { ); }, 'block_markup' => $block_markup, - 'expected_rendered_block' => ' -
-
First child
-

Hello World!

-
Last child
-
- ', + 'expected_rendered_block' => <<<'HTML' + +
+ +
First child
+ +

Hello World!

+ +
Last child
+ +
+ +HTML + , 'expected_styles' => array( 'static-view-style', 'dynamic-extra', 'static-child-view-style', 'dynamic-view-style' ), 'expected_scripts' => array( 'static-view-script', 'static-child-view-script', 'dynamic-view-script' ), 'expected_script_modules' => array( 'static-view-script-module', 'static-child-view-script-module', 'dynamic-view-script-module' ), @@ -430,12 +444,20 @@ static function ( $content ) { add_filter( 'render_block_core/dynamic', '__return_empty_string' ); }, 'block_markup' => $block_markup, - 'expected_rendered_block' => ' -
-
First child
-
Last child
-
- ', + 'expected_rendered_block' => <<<'HTML' + +
+ +
First child
+ + + +
Last child
+ +
+ +HTML + , 'expected_styles' => array( 'static-view-style', 'static-child-view-style' ), 'expected_scripts' => array( 'static-view-script', 'static-child-view-script' ), 'expected_script_modules' => array( 'static-view-script-module', 'static-child-view-script-module' ), @@ -456,12 +478,20 @@ static function ( $enqueue, $block_name ) { ); }, 'block_markup' => $block_markup, - 'expected_rendered_block' => ' -
-
First child
-
Last child
-
- ', + 'expected_rendered_block' => <<<'HTML' + +
+ +
First child
+ + + +
Last child
+ +
+ +HTML + , 'expected_styles' => array( 'static-view-style', 'static-child-view-style', 'dynamic-view-style' ), 'expected_scripts' => array( 'static-view-script', 'static-child-view-script', 'dynamic-view-script' ), 'expected_script_modules' => array( 'static-view-script-module', 'static-child-view-script-module', 'dynamic-view-script-module' ), @@ -488,11 +518,16 @@ static function ( $content ) { add_filter( 'render_block_core/static-child', '__return_empty_string' ); }, 'block_markup' => $block_markup, - 'expected_rendered_block' => ' -
-

Hello World!

-
- ', + 'expected_rendered_block' => <<<'HTML' + +
+ +

Hello World!

+ +
+ +HTML + , 'expected_styles' => array( 'static-view-style', 'dynamic-view-style' ), 'expected_scripts' => array( 'static-view-script', 'dynamic-view-script' ), 'expected_script_modules' => array( 'static-view-script-module', 'dynamic-view-script-module' ), @@ -512,12 +547,18 @@ static function ( $content ) { ); }, 'block_markup' => $block_markup, - 'expected_rendered_block' => ' -
-
First child
-

Hello World!

-
- ', + 'expected_rendered_block' => <<<'HTML' + +
+ +
First child
+ +

Hello World!

+ +
+ +HTML + , 'expected_styles' => array( 'static-view-style', 'static-child-view-style', 'dynamic-view-style' ), 'expected_scripts' => array( 'static-view-script', 'static-child-view-script', 'dynamic-view-script' ), 'expected_script_modules' => array( 'static-view-script-module', 'static-child-view-script-module', 'dynamic-view-script-module' ), @@ -562,9 +603,8 @@ static function ( $content ) { ); }, 'block_markup' => '
', - 'expected_rendered_block' => ' -
- ', + 'expected_rendered_block' => + '
', 'expected_styles' => array( 'static-view-style', 'admin-bar' ), 'expected_scripts' => array( 'static-view-script', 'admin-bar' ), 'expected_script_modules' => array( 'static-view-script-module' ), @@ -682,7 +722,7 @@ public function test_render_enqueues_scripts_and_styles( ?Closure $set_up, strin $expected_rendered_block, $rendered_block, '', - "Rendered block does not contain expected HTML:\n$rendered_block" + 'Rendered block does not contain expected HTML.' ); } diff --git a/tests/phpunit/tests/build-visual-html-tree.php b/tests/phpunit/tests/build-visual-html-tree.php index 42e35c5b74b9f..d377092565c04 100644 --- a/tests/phpunit/tests/build-visual-html-tree.php +++ b/tests/phpunit/tests/build-visual-html-tree.php @@ -9,13 +9,13 @@ */ class Tests_Build_Equivalent_HTML_Semantic_Tree extends WP_UnitTestCase { public function data_build_equivalent_html_semantic_tree() { - $block_markup = << -
- -END; + $block_markup = <<<'HTML' + +
+ +HTML; - $tree_structure = << class="has-custom-classname is-style-default wp-block-separator" style="margin-top:50px;margin-bottom:50px;" + " +" -END; +TREE; - return array( - 'Block delimiter' => array( $block_markup, $tree_structure ), - ); + yield 'Block delimiter' => array( $block_markup, $tree_structure ); + + $block_markup = <<<'HTML' + + One + + Two + + Three + + Four + +HTML; + + $tree_structure = <<<'TREE' +BLOCK["example/block"] + " + One + " + BLOCK["example/nested-void"] + " + Two + " + BLOCK["example/nested"] + " + Three + " + " + Four +" + +TREE; + + yield 'Text nodes in blocks' => array( $block_markup, $tree_structure ); } /** @@ -141,4 +176,41 @@ public function test_build_equivalent_html_semantic_tree_with_non_equivalent_htm $this->assertNotSame( $tree_expected, $tree_actual ); } + + /** + * @ticket 64531 + * + * @covers ::build_visual_html_tree + */ + public function test_spacing() { + $html = <<<'HTML' +

space-surrounded

+

 nbsp-surrounded 

+

+newline-surrounded

+

tab-surrounded

+

ok

+HTML; + + $expected = << + " space-surrounded " +"\n" +

+ "\u{00A0}nbsp-surrounded\u{00A0}" +"\n" +

+ "\nnewline-surrounded\n" +"\n" +

+ "\ttab-surrounded\t" +"\n" +

+ "ok" + +TREE; + + $tree_result = build_visual_html_tree( $html, '' ); + $this->assertSame( $expected, $tree_result ); + } } diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php index 8cca03010cad2..125ba9ea333ed 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -287,7 +287,7 @@ public function test_delayed_dependent_with_blocking_dependency( $strategy ) { wp_enqueue_script( 'main-script-a2', '/main-script-a2.js', array( 'dependency-script-a2' ), null, compact( 'strategy' ) ); $output = get_echo( 'wp_print_scripts' ); $expected = "\n"; - $expected .= ""; + $expected .= "\n"; $this->assertEqualHTML( $expected, $output, '', 'Dependents of a blocking dependency are free to have any strategy.' ); } @@ -309,8 +309,9 @@ public function test_blocking_dependent_with_delayed_dependency( $strategy ) { wp_enqueue_script( 'dependent-script-a3', '/dependent-script-a3.js', array( 'main-script-a3' ), null ); $output = get_echo( 'wp_print_scripts' ); $expected = << - + + + JS; $this->assertEqualHTML( $expected, $output, '', 'Blocking dependents must force delayed dependencies to become blocking.' ); } @@ -1076,7 +1077,7 @@ public function test_various_strategy_dependency_chains( $set_up, $expected_mark public function test_loading_strategy_with_defer_having_no_dependents_nor_dependencies() { wp_enqueue_script( 'main-script-d1', 'http://example.com/main-script-d1.js', array(), null, array( 'strategy' => 'defer' ) ); $output = get_echo( 'wp_print_scripts' ); - $expected = "\n"; + $expected = ""; $this->assertEqualHTMLScriptTagById( $expected, $output, 'Expected defer, as there is no dependent or dependency' ); } @@ -1285,22 +1286,20 @@ public function data_provider_to_test_fetchpriority_bumping(): array { return array( 'enqueue_bajo' => array( 'enqueues' => array( 'bajo' ), - 'expected' => '', + 'expected' => "\n", ), 'enqueue_auto' => array( 'enqueues' => array( 'auto' ), - 'expected' => ' - - - ', + 'expected' => + "\n" . + "\n", ), 'enqueue_alto' => array( 'enqueues' => array( 'alto' ), - 'expected' => ' - - - - ', + 'expected' => + "\n" . + "\n" . + "\n", ), ); } @@ -1354,16 +1353,17 @@ public function test_fetchpriority_bumping_a_to_z() { wp_enqueue_script( 'x' ); $actual = get_echo( 'wp_print_scripts' ); - $expected = ' - - - - - - - - - '; + $expected = <<<'HTML' + + + + + + + + + +HTML; $this->assertEqualHTML( $expected, $actual, '', "Snapshot:\n$actual" ); } @@ -1419,7 +1419,7 @@ public function test_priority_of_dependency_for_non_enqueued_dependent() { $actual = $this->normalize_markup_for_snapshot( get_echo( array( $wp_scripts, 'print_scripts' ) ) ); $this->assertEqualHTML( - '', + "\n", $actual, '', "Snapshot:\n$actual" @@ -1456,7 +1456,7 @@ public function test_printing_default_script_comment_reply_enqueued_or_not_enque $this->assertEqualHTML( sprintf( - '', + "\n", includes_url( 'js/comment-reply.js' ) ), $markup @@ -1497,7 +1497,7 @@ public function test_loading_strategy_with_invalid_defer_registration() { wp_enqueue_script( 'dependent-script-d4-3', '/dependent-script-d4-3.js', array( 'dependent-script-d4-2' ), null, array( 'strategy' => 'defer' ) ); $output = get_echo( 'wp_print_scripts' ); - $expected = "\n"; + $expected = ""; $this->assertEqualHTMLScriptTagById( $expected, $output, 'Scripts registered as defer but that have all dependents with no strategy, should become blocking (no strategy).' ); } @@ -2210,6 +2210,7 @@ public function test_wp_add_inline_script_before() { console.log("before"); //# sourceURL=test-example-js-before + HTML; $expected .= "\n"; @@ -2229,6 +2230,7 @@ public function test_wp_add_inline_script_after() { console.log("after"); //# sourceURL=test-example-js-after + HTML; $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); @@ -2574,13 +2576,13 @@ public function test_wp_add_inline_script_customize_dependency() { _print_scripts(); $print_scripts = $this->getActualOutput(); - $expected = "\n"; + $expected = ""; $this->assertEqualHTMLScriptTagById( $expected, $print_scripts ); $expected = "\n"; + $expected .= ''; $this->assertEqualHTMLScriptTagById( $expected, $print_scripts ); } @@ -3567,10 +3569,9 @@ public function data_provider_script_move_to_footer() { wp_enqueue_script( 'script-b', 'https://example.com/script-b.js', array( 'script-a' ), null, array( 'in_footer' => true ) ); }, 'expected_header' => '', - 'expected_footer' => ' - - - ', + 'expected_footer' => + "\n" . + "\n", 'expected_in_footer' => array( 'script-a', 'script-b', @@ -3588,10 +3589,9 @@ public function data_provider_script_move_to_footer() { wp_enqueue_script( 'script-b', 'https://example.com/script-b.js', array( 'script-a' ), null, array( 'in_footer' => true ) ); }, 'expected_header' => '', - 'expected_footer' => ' - - - ', + 'expected_footer' => + "\n" . + "\n", 'expected_in_footer' => array( 'script-a', 'script-b', @@ -3608,10 +3608,9 @@ public function data_provider_script_move_to_footer() { wp_enqueue_script( 'script-a', 'https://example.com/script-a.js', array(), null, array( 'strategy' => 'defer' ) ); wp_enqueue_script( 'script-b', 'https://example.com/script-b.js', array( 'script-a' ), null, array( 'in_footer' => false ) ); }, - 'expected_header' => ' - - - ', + 'expected_header' => + "\n" . + "\n", 'expected_footer' => '', 'expected_in_footer' => array(), 'expected_groups' => array( @@ -3635,12 +3634,10 @@ public function data_provider_script_move_to_footer() { ) ); }, - 'expected_header' => ' - - ', - 'expected_footer' => ' - - ', + 'expected_header' => + "\n", + 'expected_footer' => + "\n", 'expected_in_footer' => array( 'script-b', ), @@ -3685,14 +3682,12 @@ public function data_provider_script_move_to_footer() { ) ); }, - 'expected_header' => ' - - - ', - 'expected_footer' => ' - - - ', + 'expected_header' => + "\n" . + "\n", + 'expected_footer' => + "\n" . + "\n", 'expected_in_footer' => array( 'script-c', 'script-d', @@ -3732,12 +3727,11 @@ public function data_provider_script_move_to_footer() { ); }, 'expected_header' => '', - 'expected_footer' => ' - - - - - ', + 'expected_footer' => + "\n" . + "\n" . + "\n" . + "\n", 'expected_in_footer' => array( 'script-a', 'script-b', @@ -3779,14 +3773,12 @@ public function data_provider_script_move_to_footer() { ) ); }, - 'expected_header' => ' - - - ', - 'expected_footer' => ' - - - ', + 'expected_header' => + "\n" . + "\n", + 'expected_footer' => + "\n" . + "\n", 'expected_in_footer' => array( 'script-c', 'script-d', @@ -3997,6 +3989,7 @@ public function test_source_url_with_concat() { $print_scripts = get_echo( '_print_scripts' ); $expected = << var one = {"key":"val"};var two = {"key":"val"}; //# sourceURL=js-inline-concat-one%2Ctwo @@ -4070,7 +4063,7 @@ public function test_varying_versions_added_to_handle_args_enqueued_scripts( $ve wp_enqueue_script( 'test-script?qs1=q1&qs2=q2', '/test-script.js', array(), $version ); $markup = get_echo( 'wp_print_scripts' ); - $expected = ""; + $expected = "\n"; $this->assertEqualHTML( $expected, $markup, '', 'Expected equal snapshot for wp_print_scripts() with version ' . var_export( $version, true ) . ":\n$markup" ); } @@ -4091,7 +4084,7 @@ public function test_varying_versions_added_to_handle_args_registered_then_enque wp_enqueue_script( 'test-script?qs1=q1&qs2=q2' ); $markup = get_echo( 'wp_print_scripts' ); - $expected = ""; + $expected = "\n"; $this->assertEqualHTML( $expected, $markup, '', 'Expected equal snapshot for wp_print_scripts() with version ' . var_export( $version, true ) . ":\n$markup" ); } diff --git a/tests/phpunit/tests/dependencies/styles.php b/tests/phpunit/tests/dependencies/styles.php index 57687752f6a08..bbaf9432d8df0 100644 --- a/tests/phpunit/tests/dependencies/styles.php +++ b/tests/phpunit/tests/dependencies/styles.php @@ -882,6 +882,7 @@ public function test_source_url_with_concat() { h1 { background: blue; }h2 { color: green; } /*# sourceURL=css-inline-concat-one%2Ctwo */ + HTML; $this->assertEqualHTML( $expected, $printed ); @@ -935,7 +936,7 @@ public function test_varying_versions_added_to_handle_args_enqueued_styles( $ver wp_enqueue_style( 'test-style?qs1=q1&qs2=q2', '/test-style.css', array(), $version ); $markup = get_echo( 'wp_print_styles' ); - $expected = ""; + $expected = "\n"; $this->assertEqualHTML( $expected, $markup, '', 'Expected equal snapshot for wp_print_styles() with version ' . var_export( $version, true ) . ":\n$markup" ); } @@ -956,7 +957,7 @@ public function test_varying_versions_added_to_handle_args_registered_then_enque wp_enqueue_style( 'test-style?qs1=q1&qs2=q2' ); $markup = get_echo( 'wp_print_styles' ); - $expected = ""; + $expected = "\n"; $this->assertEqualHTML( $expected, $markup, '', 'Expected equal snapshot for wp_print_styles() with version ' . var_export( $version, true ) . ":\n$markup" ); } diff --git a/tests/phpunit/tests/functions/wpGetArchives.php b/tests/phpunit/tests/functions/wpGetArchives.php index 3f98d5c5644f6..99967e9be3211 100644 --- a/tests/phpunit/tests/functions/wpGetArchives.php +++ b/tests/phpunit/tests/functions/wpGetArchives.php @@ -221,10 +221,10 @@ static function ( $args ) { $ids = array_slice( array_reverse( self::$post_ids ), 0, 3 ); $expected = join( - "\n", + '', array_map( static function ( $id ) { - return sprintf( '

  • %s
  • ', get_permalink( $id ), get_the_title( $id ) ); + return sprintf( "\t
  • %s
  • \n", get_permalink( $id ), get_the_title( $id ) ); }, $ids ) diff --git a/tests/phpunit/tests/script-modules/wpScriptModules.php b/tests/phpunit/tests/script-modules/wpScriptModules.php index 047176bdb2d8b..1bd8b5c1663d3 100644 --- a/tests/phpunit/tests/script-modules/wpScriptModules.php +++ b/tests/phpunit/tests/script-modules/wpScriptModules.php @@ -572,15 +572,17 @@ static function ( $src, $id ) { 10, 2 ); - $actual = get_echo( array( wp_script_modules(), 'print_enqueued_script_modules' ) ); + $actual = get_echo( array( wp_script_modules(), 'print_enqueued_script_modules' ) ); + $expected = <<<'HTML' + + + +HTML; $this->assertEqualHTML( - ' - - - ', + $expected, $actual, '', - "Expected only one SCRIPT tag to be printed. Snapshot:\n$actual" + 'Expected only one SCRIPT tag to be printed.' ); } @@ -1476,25 +1478,31 @@ public function test_in_footer_methods() { $actual_head = get_echo( array( wp_script_modules(), 'print_head_enqueued_script_modules' ) ); $actual_footer = get_echo( array( wp_script_modules(), 'print_enqueued_script_modules' ) ); + $expected = <<<'HTML' + + + + +HTML; + $this->assertEqualHTML( $actual_head, - ' - - - - ', + $expected, '', - "Expected equal script modules in the HEAD. Snapshot:\n$actual_head" + 'Expected equal script modules in the HEAD.' ); + + $expected = <<<'HTML' + + + + +HTML; $this->assertEqualHTML( $actual_footer, - ' - - - - ', + $expected, '', - "Expected equal script modules in the footer. Snapshot:\n$actual_footer" + 'Expected equal script modules in the footer.' ); } @@ -1746,17 +1754,18 @@ public function test_fetchpriority_bumping_a_to_z() { $actual = get_echo( array( wp_script_modules(), 'print_script_module_preloads' ) ); $actual .= get_echo( array( wp_script_modules(), 'print_enqueued_script_modules' ) ); - $expected = ' - - - - - - - - - '; - $this->assertEqualHTML( $expected, $actual, '', "Snapshot:\n$actual" ); + $expected = <<<'HTML' + + + + + + + + + +HTML; + $this->assertEqualHTML( $expected, $actual ); } /** @@ -1791,18 +1800,19 @@ public function test_fetchpriority_propagation() { $actual = get_echo( array( wp_script_modules(), 'print_script_module_preloads' ) ); $actual .= get_echo( array( wp_script_modules(), 'print_enqueued_script_modules' ) ); - $expected = ' - - - - - - - - - - '; - $this->assertEqualHTML( $expected, $actual, '', "Snapshot:\n$actual" ); + $expected = <<<'HTML' + + + + + + + + + + +HTML; + $this->assertEqualHTML( $expected, $actual ); } /** @@ -1822,31 +1832,25 @@ public function test_default_script_modules() { $actual_preloads = $this->normalize_markup_for_snapshot( get_echo( array( wp_script_modules(), 'print_script_module_preloads' ) ) ); $this->assertEqualHTML( - ' - - ', - $actual_preloads, - '', - "Snapshot:\n$actual_preloads" + "\n", + $actual_preloads ); $actual_head_script_modules = $this->normalize_markup_for_snapshot( get_echo( array( wp_script_modules(), 'print_head_enqueued_script_modules' ) ) ); $this->assertEqualHTML( '', - $actual_head_script_modules, - '', - "Snapshot:\n$actual_head_script_modules" + $actual_head_script_modules ); $actual_footer_script_modules = $this->normalize_markup_for_snapshot( get_echo( array( wp_script_modules(), 'print_enqueued_script_modules' ) ) ); + $expected = <<<'HTML' + + + +HTML; $this->assertEqualHTML( - ' - - - ', - $actual_footer_script_modules, - '', - "Snapshot:\n$actual_footer_script_modules" + $expected, + $actual_footer_script_modules ); } @@ -1866,10 +1870,8 @@ public function test_priority_of_dependency_for_non_enqueued_dependent() { $actual = $this->normalize_markup_for_snapshot( get_echo( array( wp_script_modules(), 'print_enqueued_script_modules' ) ) ); $this->assertEqualHTML( - '', - $actual, - '', - "Snapshot:\n$actual" + "\n", + $actual ); } @@ -1895,13 +1897,14 @@ public function test_dependent_of_default_script_modules() { $actual = $this->normalize_markup_for_snapshot( $actual ); - $expected = ' - - - - - '; - $this->assertEqualHTML( $expected, $actual, '', "Snapshot:\n$actual" ); + $expected = <<<'HTML' + + + + + +HTML; + $this->assertEqualHTML( $expected, $actual ); } /** @@ -2340,20 +2343,16 @@ public function test_static_import_dependency_with_dynamic_imports_depending_on_ "Expected import map to match snapshot:\n" . var_export( $import_map, true ) ); $this->assertEqualHTML( - ' - - ', + "\n", $preload_links, '', - "Expected preload links to match snapshot:\n$preload_links" + 'Expected preload links to match.' ); $this->assertEqualHTML( - ' - - ', + "\n", $script_modules, '', - "Expected script modules to match snapshot:\n$script_modules" + 'Expected script modules to match.' ); }