diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php index 150ff1d7bfc91..096230063cc12 100644 --- a/tests/phpunit/includes/abstract-testcase.php +++ b/tests/phpunit/includes/abstract-testcase.php @@ -1195,11 +1195,11 @@ public function assertQueryTrue( ...$prop ) { * @param string $actual The actual HTML. * @param string|null $fragment_context Optional. The fragment context, for example "" expected HTML * must occur within "" fragment context. Default "". - * Only `` or `null` are supported at this time. - * Set to null to parse a full HTML document. + * Only "" or `null` are supported at this time. + * Set to `null` to parse a full HTML document. * @param string|null $message Optional. The assertion error message. */ - public function assertEqualBlockMarkup( string $expected, string $actual, ?string $fragment_context = '', $message = 'HTML markup was not equivalent.' ): void { + public function assertEqualMarkup( string $expected, string $actual, ?string $fragment_context = '', $message = 'HTML markup was not equivalent.' ): void { try { $tree_expected = build_equivalent_html_semantic_tree( $expected, $fragment_context ); $tree_actual = build_equivalent_html_semantic_tree( $actual, $fragment_context ); diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php index f96539f5c3256..03d118bca1045 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -125,7 +125,7 @@ public function test_after_inline_script_with_delayed_main_script( $strategy ) { 'id' => 'ms-isa-1-js-after', ) ); - $this->assertEqualMarkup( $expected, $output, 'Inline scripts in the "after" position, that are attached to a deferred main script, are failing to print/execute.' ); + $this->assertEqualMarkup( $expected, $output, '', 'Inline scripts in the "after" position, that are attached to a deferred main script, are failing to print/execute.' ); } /** @@ -154,7 +154,7 @@ public function test_after_inline_script_with_blocking_main_script() { ) ); - $this->assertEqualMarkup( $expected, $output, 'Inline scripts in the "after" position, that are attached to a blocking main script, are failing to print/execute.' ); + $this->assertEqualMarkup( $expected, $output, '', 'Inline scripts in the "after" position, that are attached to a blocking main script, are failing to print/execute.' ); } /** @@ -187,9 +187,9 @@ public function test_before_inline_scripts_with_delayed_main_script( $strategy ) 'id' => 'ds-i1-1-js-before', ) ); - $expected .= "\n"; - $expected .= "\n"; - $expected .= "\n"; + $expected .= "\n"; + $expected .= "\n"; + $expected .= "\n"; $expected .= wp_get_inline_script_tag( 'console.log("before last");', array( @@ -197,9 +197,9 @@ public function test_before_inline_scripts_with_delayed_main_script( $strategy ) 'type' => 'text/javascript', ) ); - $expected .= "\n"; + $expected .= "\n"; - $this->assertEqualMarkup( $expected, $output, 'Inline scripts in the "before" position, that are attached to a deferred main script, are failing to print/execute.' ); + $this->assertEqualMarkup( $expected, $output, '', 'Inline scripts in the "before" position, that are attached to a deferred main script, are failing to print/execute.' ); } /** @@ -216,8 +216,8 @@ public function test_loading_strategy_with_valid_async_registration() { // No dependents, No dependencies then async. wp_enqueue_script( 'main-script-a1', '/main-script-a1.js', array(), null, array( 'strategy' => 'async' ) ); $output = get_echo( 'wp_print_scripts' ); - $expected = "\n"; - $this->assertEqualMarkup( $expected, $output, 'Scripts enqueued with an async loading strategy are failing to have the async attribute applied to the script handle when being printed.' ); + $expected = "\n"; + $this->assertEqualMarkup( $expected, $output, '', 'Scripts enqueued with an async loading strategy are failing to have the async attribute applied to the script handle when being printed.' ); } /** @@ -238,9 +238,9 @@ public function test_delayed_dependent_with_blocking_dependency( $strategy ) { wp_enqueue_script( 'dependency-script-a2', '/dependency-script-a2.js', array(), null ); 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 .= ""; - $this->assertEqualMarkup( $expected, $output, 'Dependents of a blocking dependency are free to have any strategy.' ); + $expected = "\n"; + $expected .= ""; + $this->assertEqualMarkup( $expected, $output, '', 'Dependents of a blocking dependency are free to have any strategy.' ); } /** @@ -264,7 +264,7 @@ public function test_blocking_dependent_with_delayed_dependency( $strategy ) { JS; - $this->assertEqualMarkup( $expected, $output, 'Blocking dependents must force delayed dependencies to become blocking.' ); + $this->assertEqualMarkup( $expected, $output, '', 'Blocking dependents must force delayed dependencies to become blocking.' ); } /** @@ -511,18 +511,26 @@ public function data_provider_to_test_various_strategy_dependency_chains() { }, 'expected_markup' => << +/* */ HTML , @@ -548,25 +556,37 @@ public function data_provider_to_test_various_strategy_dependency_chains() { }, 'expected_markup' => << +/* */ HTML , @@ -584,18 +604,26 @@ public function data_provider_to_test_various_strategy_dependency_chains() { }, 'expected_markup' => << +/* */ HTML , @@ -613,18 +641,26 @@ public function data_provider_to_test_various_strategy_dependency_chains() { }, 'expected_markup' => << +/* */ HTML , @@ -645,17 +681,25 @@ public function data_provider_to_test_various_strategy_dependency_chains() { }, 'expected_markup' => << +/* */ HTML , @@ -679,25 +723,37 @@ public function data_provider_to_test_various_strategy_dependency_chains() { }, 'expected_markup' => << +/* */ HTML , @@ -720,17 +776,25 @@ public function data_provider_to_test_various_strategy_dependency_chains() { }, 'expected_markup' => << +/* */ HTML , @@ -751,25 +815,37 @@ public function data_provider_to_test_various_strategy_dependency_chains() { }, 'expected_markup' => << +/* */ HTML , @@ -790,25 +866,37 @@ public function data_provider_to_test_various_strategy_dependency_chains() { }, 'expected_markup' => << +/* */ HTML , @@ -826,18 +914,26 @@ public function data_provider_to_test_various_strategy_dependency_chains() { }, 'expected_markup' => << +/* */ HTML , @@ -851,9 +947,11 @@ public function data_provider_to_test_various_strategy_dependency_chains() { }, 'expected_markup' => << +/* */ - + HTML , ), @@ -867,7 +965,9 @@ public function data_provider_to_test_various_strategy_dependency_chains() { 'expected_markup' => << HTML , @@ -883,9 +983,9 @@ public function data_provider_to_test_various_strategy_dependency_chains() { wp_enqueue_script( 'theme-functions', 'https://example.com/theme-functions.js', array( 'jquery' ), null, array( 'strategy' => 'defer' ) ); }, 'expected_markup' => << - - + + + HTML , ), @@ -912,11 +1012,15 @@ public function data_provider_to_test_various_strategy_dependency_chains() { HTML , @@ -935,9 +1039,9 @@ public function data_provider_to_test_various_strategy_dependency_chains() { $this->enqueue_test_script( 'defer-dependent-of-async-aliases', 'defer', array( $alias_handle ) ); }, 'expected_markup' => << - - + + + HTML , ), @@ -960,7 +1064,7 @@ public function data_provider_to_test_various_strategy_dependency_chains() { public function test_various_strategy_dependency_chains( $set_up, $expected_markup ) { $set_up(); $actual_markup = get_echo( 'wp_print_scripts' ); - $this->assertEqualMarkup( trim( $expected_markup ), trim( $actual_markup ), "Actual markup:\n{$actual_markup}" ); + $this->assertEqualMarkup( trim( $expected_markup ), trim( $actual_markup ), '', "Actual markup:\n{$actual_markup}" ); } /** @@ -1036,12 +1140,12 @@ public function test_defer_with_async_dependent() { wp_enqueue_script( 'dependent-script-d4-2', '/dependent-script-d4-2.js', array( 'dependent-script-d4-1' ), null, array( 'strategy' => 'async' ) ); 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 .= "\n"; - $expected .= "\n"; - $expected .= "\n"; + $expected = "\n"; + $expected .= "\n"; + $expected .= "\n"; + $expected .= "\n"; - $this->assertEqualMarkup( $expected, $output, 'Scripts registered as defer but that have dependents that are async are expected to have said dependents deferred.' ); + $this->assertEqualMarkup( $expected, $output, '', 'Scripts registered as defer but that have dependents that are async are expected to have said dependents deferred.' ); } /** @@ -1113,7 +1217,7 @@ public function test_scripts_targeting_head() { $expected_header .= "\n"; $expected_header .= "\n"; - $this->assertEqualMarkup( $expected_header, $actual_header, 'Scripts registered/enqueued using the older $in_footer parameter or the newer $args parameter should have the same outcome.' ); + $this->assertEqualMarkup( $expected_header, $actual_header, '', 'Scripts registered/enqueued using the older $in_footer parameter or the newer $args parameter should have the same outcome.' ); $this->assertEmpty( $actual_footer, 'Expected footer to be empty since all scripts were for head.' ); } @@ -1141,7 +1245,7 @@ public function test_scripts_targeting_footer() { $expected_footer .= "\n"; $this->assertEmpty( $actual_header, 'Expected header to be empty since all scripts targeted footer.' ); - $this->assertEqualMarkup( $expected_footer, $actual_footer, 'Scripts registered/enqueued using the older $in_footer parameter or the newer $args parameter should have the same outcome.' ); + $this->assertEqualMarkup( $expected_footer, $actual_footer, '', 'Scripts registered/enqueued using the older $in_footer parameter or the newer $args parameter should have the same outcome.' ); } /** @@ -1342,9 +1446,9 @@ public function test_concatenate_with_defer_strategy() { $concatenate_scripts = $old_value; $expected = "\n"; - $expected .= "\n"; + $expected .= "\n"; - $this->assertEqualMarkup( $expected, $print_scripts, 'Scripts are being incorrectly concatenated when a main script is registered with a "defer" loading strategy. Deferred scripts should not be part of the script concat loading query.' ); + $this->assertEqualMarkup( $expected, $print_scripts, '', 'Scripts are being incorrectly concatenated when a main script is registered with a "defer" loading strategy. Deferred scripts should not be part of the script concat loading query.' ); } /** @@ -1377,9 +1481,9 @@ public function test_concatenate_with_async_strategy() { $concatenate_scripts = $old_value; $expected = "\n"; - $expected .= "\n"; + $expected .= "\n"; - $this->assertEqualMarkup( $expected, $print_scripts, 'Scripts are being incorrectly concatenated when a main script is registered with an "async" loading strategy. Async scripts should not be part of the script concat loading query.' ); + $this->assertEqualMarkup( $expected, $print_scripts, '', 'Scripts are being incorrectly concatenated when a main script is registered with an "async" loading strategy. Async scripts should not be part of the script concat loading query.' ); } /** @@ -1416,9 +1520,9 @@ public function test_concatenate_with_blocking_script_before_and_after_script_wi $concatenate_scripts = $old_value; $expected = "\n"; - $expected .= "\n"; + $expected .= "\n"; - $this->assertEqualMarkup( $expected, $print_scripts, 'Scripts are being incorrectly concatenated when a main script is registered as deferred after other blocking scripts are registered. Deferred scripts should not be part of the script concat loader query string. ' ); + $this->assertEqualMarkup( $expected, $print_scripts, '', 'Scripts are being incorrectly concatenated when a main script is registered as deferred after other blocking scripts are registered. Deferred scripts should not be part of the script concat loader query string. ' ); } /** @@ -1427,6 +1531,8 @@ public function test_concatenate_with_blocking_script_before_and_after_script_wi public function test_wp_enqueue_script_with_html5_support_does_not_contain_type_attribute() { global $wp_version; + $this->add_html5_script_theme_support(); + $GLOBALS['wp_scripts'] = new WP_Scripts(); $GLOBALS['wp_scripts']->default_version = get_bloginfo( 'version' ); @@ -1531,7 +1637,7 @@ public function test_wp_script_add_data_with_conditional_key() { // Enqueue and add conditional comments. wp_enqueue_script( 'test-only-conditional', 'example.com', array(), null ); wp_script_add_data( 'test-only-conditional', 'conditional', 'gt IE 7' ); - $expected = "\n"; + $expected = "\n"; // Go! $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) ); @@ -1690,8 +1796,8 @@ public function test_wp_register_script_with_dependencies_in_head_and_footer() { $expected_header .= "\n"; $expected_footer = "\n"; - $this->assertEqualMarkup( $expected_header, $header, 'Expected same header markup.' ); - $this->assertEqualMarkup( $expected_footer, $footer, 'Expected same footer markup.' ); + $this->assertEqualMarkup( $expected_header, $header, '', 'Expected same header markup.' ); + $this->assertEqualMarkup( $expected_footer, $footer, '', 'Expected same footer markup.' ); } /** @@ -1711,8 +1817,8 @@ public function test_wp_register_script_with_dependencies_in_head_and_footer_in_ $expected_footer = "\n"; $expected_footer .= "\n"; - $this->assertEqualMarkup( $expected_header, $header, 'Expected same header markup.' ); - $this->assertEqualMarkup( $expected_footer, $footer, 'Expected same footer markup.' ); + $this->assertEqualMarkup( $expected_header, $header, '', 'Expected same header markup.' ); + $this->assertEqualMarkup( $expected_footer, $footer, '', 'Expected same footer markup.' ); } /** @@ -1742,8 +1848,8 @@ public function test_wp_register_script_with_dependencies_in_head_and_footer_in_ $expected_footer .= "\n"; $expected_footer .= "\n"; - $this->assertEqualMarkup( $expected_header, $header, 'Expected same header markup.' ); - $this->assertEqualMarkup( $expected_footer, $footer, 'Expected same footer markup.' ); + $this->assertEqualMarkup( $expected_header, $header, '', 'Expected same header markup.' ); + $this->assertEqualMarkup( $expected_footer, $footer, '', 'Expected same footer markup.' ); } /** @@ -1770,7 +1876,13 @@ public function test_wp_add_inline_script_before() { wp_enqueue_script( 'test-example', 'example.com', array(), null ); wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ); - $expected = "\n"; + $expected = << +/* */ + +HTML; $expected .= "\n"; $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) ); @@ -1784,7 +1896,13 @@ public function test_wp_add_inline_script_after() { wp_add_inline_script( 'test-example', 'console.log("after");' ); $expected = "\n"; - $expected .= "\n"; + $expected .= << +/* */ + +HTML; $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) ); } @@ -1797,9 +1915,9 @@ public function test_wp_add_inline_script_before_and_after() { wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ); wp_add_inline_script( 'test-example', 'console.log("after");' ); - $expected = "\n"; + $expected = "\n"; $expected .= "\n"; - $expected .= "\n"; + $expected .= "\n"; $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) ); } @@ -1812,7 +1930,7 @@ public function test_wp_add_inline_script_before_for_handle_without_source() { wp_enqueue_script( 'test-example' ); wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ); - $expected = "\n"; + $expected = "\n"; $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) ); } @@ -1825,7 +1943,7 @@ public function test_wp_add_inline_script_after_for_handle_without_source() { wp_enqueue_script( 'test-example' ); wp_add_inline_script( 'test-example', 'console.log("after");' ); - $expected = "\n"; + $expected = "\n"; $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) ); } @@ -1839,8 +1957,8 @@ public function test_wp_add_inline_script_before_and_after_for_handle_without_so wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ); wp_add_inline_script( 'test-example', 'console.log("after");' ); - $expected = "\n"; - $expected .= "\n"; + $expected = "\n"; + $expected .= "\n"; $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) ); } @@ -1855,9 +1973,9 @@ public function test_wp_add_inline_script_multiple() { wp_add_inline_script( 'test-example', 'console.log("after");' ); wp_add_inline_script( 'test-example', 'console.log("after");' ); - $expected = "\n"; + $expected = "\n"; $expected .= "\n"; - $expected .= "\n"; + $expected .= "\n"; $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) ); } @@ -1872,9 +1990,9 @@ public function test_wp_add_inline_script_localized_data_is_added_first() { wp_add_inline_script( 'test-example', 'console.log("after");' ); $expected = "\n"; - $expected .= "\n"; + $expected .= "\n"; $expected .= "\n"; - $expected .= "\n"; + $expected .= "\n"; $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) ); } @@ -1895,9 +2013,9 @@ public function test_wp_add_inline_script_before_with_concat() { wp_add_inline_script( 'one', 'console.log("before one");', 'before' ); wp_add_inline_script( 'two', 'console.log("before two");', 'before' ); - $expected = "\n"; + $expected = "\n"; $expected .= "\n"; - $expected .= "\n"; + $expected .= "\n"; $expected .= "\n"; $expected .= "\n"; @@ -1919,7 +2037,7 @@ public function test_wp_add_inline_script_before_with_concat2() { wp_add_inline_script( 'one', 'console.log("before one");', 'before' ); - $expected = "\n"; + $expected = "\n"; $expected .= "\n"; $expected .= "\n"; $expected .= "\n"; @@ -1946,9 +2064,9 @@ public function test_wp_add_inline_script_after_with_concat() { $expected = "\n"; $expected .= "\n"; - $expected .= "\n"; + $expected .= "\n"; $expected .= "\n"; - $expected .= "\n"; + $expected .= "\n"; $expected .= "\n"; $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) ); @@ -1969,9 +2087,9 @@ public function test_wp_add_inline_script_after_and_before_with_concat_and_condi $expected_localized = str_replace( "'", '"', $expected_localized ); $expected = "\n"; $expected = str_replace( "'", '"', $expected ); @@ -1999,7 +2117,7 @@ public function test_wp_add_inline_script_after_with_concat_and_core_dependency( $expected = "\n"; $expected .= "\n"; - $expected .= "\n"; + $expected .= "\n"; wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null ); wp_add_inline_script( 'test-example', 'console.log("after");' ); @@ -2023,8 +2141,8 @@ public function test_wp_add_inline_script_after_with_concat_and_conditional_and_ $expected = "\n"; $expected .= "\n"; wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null ); @@ -2050,7 +2168,7 @@ public function test_wp_add_inline_script_before_with_concat_and_core_dependency $wp_scripts->do_concat = true; $expected = "\n"; - $expected .= "\n"; + $expected .= "\n"; $expected .= "\n"; wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null ); @@ -2075,15 +2193,17 @@ public function test_wp_add_inline_script_before_after_concat_with_core_dependen $wp_scripts->do_concat = true; $expected = "\n"; - $expected .= "\n"; + $expected .= "\n"; $expected .= "\n"; $expected .= "\n"; $expected .= "\n"; $expected .= "\n"; $expected .= "\n"; - $expected .= "\n"; + $expected .= "\n"; wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null ); wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ); @@ -2126,7 +2246,9 @@ public function test_wp_add_inline_script_customize_dependency() { $expected_tail = "\n"; $expected_tail .= "\n"; $handle = 'customize-dependency'; @@ -2161,7 +2283,7 @@ public function test_wp_add_inline_script_after_for_core_scripts_with_concat_is_ wp_enqueue_script( 'four', '/wp-includes/js/script4.js' ); $expected = "\n"; - $expected .= "\n"; + $expected .= "\n"; $expected .= "\n"; $expected .= "\n"; $expected .= "\n"; @@ -2185,7 +2307,7 @@ public function test_wp_add_inline_script_before_third_core_script_prints_two_co wp_enqueue_script( 'four', '/wp-includes/js/script4.js' ); $expected = "\n"; - $expected .= "\n"; + $expected .= "\n"; $expected .= "\n"; $expected .= "\n"; @@ -2206,7 +2328,7 @@ public function data_provider_to_test_get_inline_script() { ), 'delayed' => false, 'expected_data' => '/*before foo 1*/', - 'expected_tag' => "\n", + 'expected_tag' => "\n", ), 'after-blocking' => array( 'position' => 'after', @@ -2216,7 +2338,7 @@ public function data_provider_to_test_get_inline_script() { ), 'delayed' => false, 'expected_data' => "/*after foo 1*/\n/*after foo 2*/", - 'expected_tag' => "\n", + 'expected_tag' => "\n", ), 'before-delayed' => array( 'position' => 'before', @@ -2225,7 +2347,7 @@ public function data_provider_to_test_get_inline_script() { ), 'delayed' => true, 'expected_data' => '/*before foo 1*/', - 'expected_tag' => "\n", + 'expected_tag' => "\n", ), 'after-delayed' => array( 'position' => 'after', @@ -2235,7 +2357,7 @@ public function data_provider_to_test_get_inline_script() { ), 'delayed' => true, 'expected_data' => "/*after foo 1*/\n/*after foo 2*/", - 'expected_tag' => "\n", + 'expected_tag' => "\n", ), ); } @@ -3014,55 +3136,6 @@ protected function parse_markup_fragment( $markup ) { return $dom; } - /** - * Assert markup is equal after normalizing script tags. - * - * @todo Retire in favor of WP_UnitTestCase::assertEqualMarkup(). - * - * @param string $expected Expected markup. - * @param string $actual Actual markup. - * @param string $message Message. - */ - protected function assertEqualMarkup( $expected, $actual, $message = '' ) { - $expected_dom = $this->parse_markup_fragment( $expected ); - $actual_dom = $this->parse_markup_fragment( $actual ); - foreach ( array( $expected_dom, $actual_dom ) as $dom ) { - $xpath = new DOMXPath( $dom ); - /** @var DOMElement $script */ - - // Normalize type attribute. When missing, it defaults to text/javascript. - foreach ( $xpath->query( '//script[ not( @type ) ]' ) as $script ) { - $script->setAttribute( 'type', 'text/javascript' ); - } - - // Normalize script contents to remove CDATA wrapper. - foreach ( $xpath->query( '//script[ contains( text(), "textContent = str_replace( - array( - "/* */", - ), - '', - $script->textContent - ); - } - - // Normalize XHTML-compatible boolean attributes to HTML5 ones. - foreach ( array( 'async', 'defer' ) as $attribute ) { - foreach ( iterator_to_array( $xpath->query( "//script[ @{$attribute} = '{$attribute}' ]" ) ) as $script ) { - $script->removeAttribute( $attribute ); - $script->setAttributeNode( $dom->createAttribute( $attribute ) ); - } - } - } - - $this->assertEquals( - $expected_dom->getElementsByTagName( 'body' )->item( 0 ), - $actual_dom->getElementsByTagName( 'body' )->item( 0 ), - $message - ); - } - /** * Adds html5 script theme support. */ @@ -3102,8 +3175,8 @@ public function test_wp_scripts_move_to_footer( $set_up, $expected_header, $expe wp_scripts()->do_footer_items(); $footer = ob_get_clean(); - $this->assertEqualMarkup( $expected_header, $header, 'Expected header script markup to match.' ); - $this->assertEqualMarkup( $expected_footer, $footer, 'Expected footer script markup to match.' ); + $this->assertEqualMarkup( $expected_header, $header, '', 'Expected header script markup to match.' ); + $this->assertEqualMarkup( $expected_footer, $footer, '', 'Expected footer script markup to match.' ); $this->assertEqualSets( $expected_in_footer, wp_scripts()->in_footer, 'Expected to have the same handles for in_footer.' ); $this->assertEquals( $expected_groups, wp_scripts()->groups, 'Expected groups to match.' ); }