diff --git a/src/wp-activate.php b/src/wp-activate.php
index 0c3321f74618c..103df0364e973 100644
--- a/src/wp-activate.php
+++ b/src/wp-activate.php
@@ -100,7 +100,7 @@ function do_activate_header() {
*/
function wpmu_activate_stylesheet() {
?>
-
-
- \n",
+ "\n",
esc_attr( $handle ),
- $this->type_attr,
$inline_style
);
} else {
@@ -232,12 +206,11 @@ public function do_item( $handle, $group = false ) {
$title = isset( $obj->extra['title'] ) ? $obj->extra['title'] : '';
$tag = sprintf(
- "\n",
+ "\n",
$rel,
esc_attr( $handle ),
$title ? sprintf( " title='%s'", esc_attr( $title ) ) : '',
$href,
- $this->type_attr,
esc_attr( $media )
);
@@ -264,12 +237,11 @@ public function do_item( $handle, $group = false ) {
}
$rtl_tag = sprintf(
- "\n",
+ "\n",
$rel,
esc_attr( $handle ),
$title ? sprintf( " title='%s'", esc_attr( $title ) ) : '',
$rtl_href,
- $this->type_attr,
esc_attr( $media )
);
@@ -365,9 +337,8 @@ public function print_inline_style( $handle, $display = true ) {
}
printf(
- "\n",
+ "\n",
esc_attr( $handle ),
- $this->type_attr,
$output
);
diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php
index 2569e5ad308c0..0b721715120de 100644
--- a/src/wp-includes/deprecated.php
+++ b/src/wp-includes/deprecated.php
@@ -5897,10 +5897,9 @@ function _wp_theme_json_webfonts_handler() {
function print_embed_styles() {
_deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_embed_styles' );
- $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
- $suffix = SCRIPT_DEBUG ? '' : '.min';
+ $suffix = SCRIPT_DEBUG ? '' : '.min';
?>
-
-
+
- \n";
- }
-
- /**
- * Gets the defined \n";
}
/**
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index ee10bb78e1d37..cfec0b6df6d45 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -3921,7 +3921,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
}
?>
- \n";
@@ -2905,13 +2903,6 @@ function wp_sanitize_script_attributes( $attributes ) {
* @return string String containing `\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
@@ -172,7 +172,7 @@ public function test_after_inline_script_with_delayed_main_script( $strategy ) {
wp_enqueue_script( 'ms-isa-1', 'http://example.org/ms-isa-1.js', array(), null, compact( 'strategy' ) );
wp_add_inline_script( 'ms-isa-1', 'console.log(\'after one\');', 'after' );
$output = get_echo( 'wp_print_scripts' );
- $expected = "\n";
+ $expected = "\n";
$expected .= wp_get_inline_script_tag(
"console.log('after one');\n//# sourceURL=ms-isa-1-js-after",
array(
@@ -185,9 +185,6 @@ public function test_after_inline_script_with_delayed_main_script( $strategy ) {
/**
* Tests that inline scripts in the `after` position, attached to a blocking main script, are rendered as javascript.
*
- * If a main script with a `blocking` strategy has an `after` inline script,
- * the inline script should be rendered as type='text/javascript'.
- *
* @ticket 12009
*
* @covers WP_Scripts::do_item
@@ -200,7 +197,7 @@ public function test_after_inline_script_with_blocking_main_script() {
wp_add_inline_script( 'ms-insa-3', 'console.log(\'after one\');', 'after' );
$output = get_echo( 'wp_print_scripts' );
- $expected = "\n";
+ $expected = "\n";
$expected .= wp_get_inline_script_tag(
"console.log('after one');\n//# sourceURL=ms-insa-3-js-after",
array(
@@ -241,17 +238,16 @@ 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');\n//# sourceURL=ms-i1-1-js-before",
array(
- 'id' => 'ms-i1-1-js-before',
- 'type' => 'text/javascript',
+ 'id' => 'ms-i1-1-js-before',
)
);
- $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, $output, '', 'Inline scripts in the "before" position, that are attached to a deferred main script, are failing to print/execute.' );
}
@@ -270,7 +266,7 @@ 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";
+ $expected = "\n";
$this->assertEqualHTML( $expected, $output, '', 'Scripts enqueued with an async loading strategy are failing to have the async attribute applied to the script handle when being printed.' );
}
@@ -292,8 +288,8 @@ 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 .= "";
+ $expected = "\n";
+ $expected .= "";
$this->assertEqualHTML( $expected, $output, '', 'Dependents of a blocking dependency are free to have any strategy.' );
}
@@ -315,8 +311,8 @@ 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.' );
}
@@ -566,27 +562,27 @@ public function data_provider_to_test_various_strategy_dependency_chains() {
}
},
'expected_markup' => <<
+
-
-
+
-
-
-
+
-
-
+
-
-
-
+
-
-
-
+
-
-
+
-
-
-
+
-
-
+
-
-
-
+
-
-
-
-
+
-
-
+
-
-
-
+
-
-
-
+
-
-
-
-
+
-
-
+
-
-
-
+
-
-
-
+
-
-
+
-
-
-
+
-
-
-
+
-
-
+
-
-
-
+
-
+
HTML
,
),
@@ -1068,8 +1064,8 @@ public function data_provider_to_test_various_strategy_dependency_chains() {
$this->add_test_inline_script( $handle, 'after' );
},
'expected_markup' => <<
-
+
-
-
+
+
+
HTML
,
),
@@ -1114,17 +1110,17 @@ public function data_provider_to_test_various_strategy_dependency_chains() {
$this->add_test_inline_script( 'defer-dependent-of-nested-aliases', 'after' );
},
'expected_markup' => <<
-
-
-
+
+
+
-
-
+
-
-
+
+
+
HTML
,
),
@@ -1280,10 +1276,10 @@ public function test_defer_with_async_dependent() {
);
// Note: All of these scripts have fetchpriority=high because the leaf dependent script has that fetch priority.
$output = get_echo( 'wp_print_scripts' );
- $expected = "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, $output, '', 'Scripts registered as defer but that have dependents that are async are expected to have said dependents deferred.' );
}
@@ -1399,21 +1395,21 @@ public function data_provider_to_test_fetchpriority_bumping(): array {
return array(
'enqueue_bajo' => array(
'enqueues' => array( 'bajo' ),
- 'expected' => '',
+ 'expected' => '',
),
'enqueue_auto' => array(
'enqueues' => array( 'auto' ),
'expected' => '
-
-
+
+
',
),
'enqueue_alto' => array(
'enqueues' => array( 'alto' ),
'expected' => '
-
-
-
+
+
+
',
),
);
@@ -1469,14 +1465,14 @@ public function test_fetchpriority_bumping_a_to_z() {
$actual = get_echo( 'wp_print_scripts' );
$expected = '
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
';
$this->assertEqualHTML( $expected, $actual, '', "Snapshot:\n$actual" );
}
@@ -1533,7 +1529,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(
- '',
+ '',
$actual,
'',
"Snapshot:\n$actual"
@@ -1570,7 +1566,7 @@ public function test_printing_default_script_comment_reply_enqueued_or_not_enque
$this->assertEqualHTML(
sprintf(
- '',
+ '',
includes_url( 'js/comment-reply.js' )
),
$markup
@@ -1610,7 +1606,7 @@ public function test_loading_strategy_with_invalid_defer_registration() {
wp_enqueue_script( 'dependent-script-d4-2', '/dependent-script-d4-2.js', array( 'dependent-script-d4-1' ), null );
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 = str_replace( "'", '"', "\n" );
+ $expected = str_replace( "'", '"', "\n" );
$this->assertStringContainsString( $expected, $output, 'Scripts registered as defer but that have all dependents with no strategy, should become blocking (no strategy).' );
}
@@ -1627,13 +1623,13 @@ public function test_loading_strategy_with_invalid_defer_registration() {
public function test_loading_strategy_with_valid_blocking_registration() {
wp_enqueue_script( 'main-script-b1', '/main-script-b1.js', array(), null );
$output = get_echo( 'wp_print_scripts' );
- $expected = "\n";
+ $expected = "\n";
$this->assertEqualHTML( $expected, $output, '', 'Scripts registered with a "blocking" strategy, and who have no dependencies, should have no loading strategy attributes printed.' );
// strategy args not set.
wp_enqueue_script( 'main-script-b2', '/main-script-b2.js', array(), null, array() );
$output = get_echo( 'wp_print_scripts' );
- $expected = "\n";
+ $expected = "\n";
$this->assertEqualHTML( $expected, $output, '', 'Scripts registered with no strategy assigned, and who have no dependencies, should have no loading strategy attributes printed.' );
}
@@ -1690,10 +1686,10 @@ public function test_scripts_targeting_head() {
$actual_header = get_echo( 'wp_print_head_scripts' );
$actual_footer = get_echo( 'wp_print_scripts' );
- $expected_header = "\n";
- $expected_header .= "\n";
- $expected_header .= "\n";
- $expected_header .= "\n";
+ $expected_header = "\n";
+ $expected_header .= "\n";
+ $expected_header .= "\n";
+ $expected_header .= "\n";
$this->assertEqualHTML( $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.' );
@@ -1717,10 +1713,10 @@ public function test_scripts_targeting_footer() {
$actual_header = get_echo( 'wp_print_head_scripts' );
$actual_footer = get_echo( 'wp_print_scripts' );
- $expected_footer = "\n";
- $expected_footer .= "\n";
- $expected_footer .= "\n";
- $expected_footer .= "\n";
+ $expected_footer = "\n";
+ $expected_footer .= "\n";
+ $expected_footer .= "\n";
+ $expected_footer .= "\n";
$this->assertEmpty( $actual_header, 'Expected header to be empty since all scripts targeted footer.' );
$this->assertEqualHTML( $expected_footer, $actual_footer, '', 'Scripts registered/enqueued using the older $in_footer parameter or the newer $args parameter should have the same outcome.' );
@@ -1843,7 +1839,7 @@ public function test_script_strategy_doing_it_wrong_via_register() {
wp_enqueue_script( 'invalid-strategy' );
$this->assertEqualHTML(
- "\n",
+ "\n",
get_echo( 'wp_print_scripts' )
);
}
@@ -1868,7 +1864,7 @@ public function test_script_strategy_doing_it_wrong_via_add_data() {
wp_enqueue_script( 'invalid-strategy' );
$this->assertEqualHTML(
- "\n",
+ "\n",
get_echo( 'wp_print_scripts' )
);
}
@@ -1889,7 +1885,7 @@ public function test_script_strategy_doing_it_wrong_via_enqueue() {
wp_enqueue_script( 'invalid-strategy', '/defaults.js', array(), null, array( 'strategy' => 'random-strategy' ) );
$this->assertEqualHTML(
- "\n",
+ "\n",
get_echo( 'wp_print_scripts' )
);
}
@@ -1919,8 +1915,8 @@ public function test_concatenate_with_defer_strategy() {
wp_print_scripts();
$print_scripts = get_echo( '_print_scripts' );
- $expected = "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $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.' );
}
@@ -1950,8 +1946,8 @@ public function test_concatenate_with_async_strategy() {
wp_print_scripts();
$print_scripts = get_echo( '_print_scripts' );
- $expected = "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $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.' );
}
@@ -1985,8 +1981,8 @@ public function test_concatenate_with_blocking_script_before_and_after_script_wi
wp_print_scripts();
$print_scripts = get_echo( '_print_scripts' );
- $expected = "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $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. ' );
}
@@ -2025,24 +2021,24 @@ public function test_protocols() {
// Try with an HTTP reference.
wp_enqueue_script( 'jquery-http', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
- $expected .= "\n";
+ $expected .= "\n";
// Try with an HTTPS reference.
wp_enqueue_script( 'jquery-https', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
- $expected .= "\n";
+ $expected .= "\n";
// Try with an automatic protocol reference (//).
wp_enqueue_script( 'jquery-doubleslash', '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
- $expected .= "\n";
+ $expected .= "\n";
// Try with a local resource and an automatic protocol reference (//).
$url = '//my_plugin/script.js';
wp_enqueue_script( 'plugin-script', $url );
- $expected .= "\n";
+ $expected .= "\n";
// Try with a bad protocol.
wp_enqueue_script( 'jquery-ftp', 'ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
- $expected .= "\n";
+ $expected .= "\n";
// Go!
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
@@ -2070,7 +2066,7 @@ public function test_script_concatenation() {
wp_print_scripts();
$print_scripts = get_echo( '_print_scripts' );
- $expected = "\n";
+ $expected = "\n";
$this->assertSame( $expected, $print_scripts );
}
@@ -2084,8 +2080,8 @@ public function test_wp_script_add_data_with_data_key() {
// Enqueue and add data.
wp_enqueue_script( 'test-only-data', 'example.com', array(), null );
wp_script_add_data( 'test-only-data', 'data', 'testing' );
- $expected = "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
// Go!
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
@@ -2120,7 +2116,7 @@ public function test_wp_script_add_data_with_invalid_key() {
// Enqueue and add an invalid key.
wp_enqueue_script( 'test-invalid', 'example.com', array(), null );
wp_script_add_data( 'test-invalid', 'invalid', 'testing' );
- $expected = "\n";
+ $expected = "\n";
// Go!
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
@@ -2143,8 +2139,8 @@ public function test_wp_register_script() {
* @ticket 35229
*/
public function test_wp_register_script_with_handle_without_source() {
- $expected = "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
wp_register_script( 'handle-one', 'http://example.com', array(), 1 );
wp_register_script( 'handle-two', 'http://example.com', array(), 2 );
@@ -2236,9 +2232,9 @@ public function test_wp_register_script_with_dependencies_in_head_and_footer() {
$header = get_echo( 'wp_print_head_scripts' );
$footer = get_echo( 'wp_print_footer_scripts' );
- $expected_header = "\n";
- $expected_header .= "\n";
- $expected_footer = "\n";
+ $expected_header = "\n";
+ $expected_header .= "\n";
+ $expected_footer = "\n";
$this->assertEqualHTML( $expected_header, $header, '', 'Expected same header markup.' );
$this->assertEqualHTML( $expected_footer, $footer, '', 'Expected same footer markup.' );
@@ -2257,9 +2253,9 @@ public function test_wp_register_script_with_dependencies_in_head_and_footer_in_
$header = get_echo( 'wp_print_head_scripts' );
$footer = get_echo( 'wp_print_footer_scripts' );
- $expected_header = "\n";
- $expected_footer = "\n";
- $expected_footer .= "\n";
+ $expected_header = "\n";
+ $expected_footer = "\n";
+ $expected_footer .= "\n";
$this->assertEqualHTML( $expected_header, $header, '', 'Expected same header markup.' );
$this->assertEqualHTML( $expected_footer, $footer, '', 'Expected same footer markup.' );
@@ -2283,14 +2279,14 @@ public function test_wp_register_script_with_dependencies_in_head_and_footer_in_
$header = get_echo( 'wp_print_head_scripts' );
$footer = get_echo( 'wp_print_footer_scripts' );
- $expected_header = "\n";
- $expected_header .= "\n";
- $expected_header .= "\n";
- $expected_header .= "\n";
+ $expected_header = "\n";
+ $expected_header .= "\n";
+ $expected_header .= "\n";
+ $expected_header .= "\n";
- $expected_footer = "\n";
- $expected_footer .= "\n";
- $expected_footer .= "\n";
+ $expected_footer = "\n";
+ $expected_footer .= "\n";
+ $expected_footer .= "\n";
$this->assertEqualHTML( $expected_header, $header, '', 'Expected same header markup.' );
$this->assertEqualHTML( $expected_footer, $footer, '', 'Expected same footer markup.' );
@@ -2321,14 +2317,14 @@ public function test_wp_add_inline_script_before() {
wp_add_inline_script( 'test-example', 'console.log("before");', 'before' );
$expected = <<
+
HTML;
- $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2340,9 +2336,9 @@ public function test_wp_add_inline_script_after() {
wp_enqueue_script( 'test-example', 'example.com', array(), null );
wp_add_inline_script( 'test-example', 'console.log("after");' );
- $expected = "\n";
+ $expected = "\n";
$expected .= <<
+\n";
- $expected .= "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2376,7 +2372,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->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2389,7 +2385,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->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2403,8 +2399,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->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2419,9 +2415,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";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2435,10 +2431,10 @@ public function test_wp_add_inline_script_localized_data_is_added_first() {
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";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2459,11 +2455,11 @@ 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";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2483,10 +2479,10 @@ 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";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2508,12 +2504,12 @@ public function test_wp_add_inline_script_after_with_concat() {
wp_add_inline_script( 'two', 'console.log("after two");' );
wp_add_inline_script( 'three', 'console.log("after three");' );
- $expected = "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2556,9 +2552,9 @@ public function test_wp_add_inline_script_after_with_concat_and_core_dependency(
$wp_scripts->base_url = '';
$wp_scripts->do_concat = true;
- $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("after");' );
@@ -2605,9 +2601,9 @@ public function test_wp_add_inline_script_before_with_concat_and_core_dependency
$wp_scripts->base_url = '';
$wp_scripts->do_concat = true;
- $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' );
@@ -2630,21 +2626,21 @@ public function test_wp_add_inline_script_before_after_concat_with_core_dependen
$wp_scripts->base_url = '';
$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";
- $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' );
wp_enqueue_script( 'test-example2', 'http://example2.com', array( 'wp-a11y' ), null );
@@ -2695,10 +2691,10 @@ public function test_wp_add_inline_script_customize_dependency() {
_print_scripts();
$print_scripts = $this->getActualOutput();
- $expected = "\n";
+ $expected = "\n";
$this->assertEqualHTMLScriptTagById( $expected, $print_scripts );
- $expected = "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2746,10 +2742,10 @@ public function test_wp_add_inline_script_before_third_core_script_prints_two_co
wp_add_inline_script( 'three', 'console.log("before three");', 'before' );
wp_enqueue_script( 'four', '/wp-includes/js/script4.js' );
- $expected = "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2768,7 +2764,7 @@ public function data_provider_to_test_get_inline_script() {
),
'delayed' => false,
'expected_data' => "/*before foo 1*/\n//# sourceURL=foo-js-before",
- 'expected_tag' => "\n",
+ 'expected_tag' => "\n",
),
'after-blocking' => array(
'position' => 'after',
@@ -2778,7 +2774,7 @@ public function data_provider_to_test_get_inline_script() {
),
'delayed' => false,
'expected_data' => "/*after foo 1*/\n/*after foo 2*/\n//# sourceURL=foo-js-after",
- 'expected_tag' => "\n",
+ 'expected_tag' => "\n",
),
'before-delayed' => array(
'position' => 'before',
@@ -2787,7 +2783,7 @@ public function data_provider_to_test_get_inline_script() {
),
'delayed' => true,
'expected_data' => "/*before foo 1*/\n//# sourceURL=foo-js-before",
- 'expected_tag' => "\n",
+ 'expected_tag' => "\n",
),
'after-delayed' => array(
'position' => 'after',
@@ -2797,7 +2793,7 @@ public function data_provider_to_test_get_inline_script() {
),
'delayed' => true,
'expected_data' => "/*after foo 1*/\n/*after foo 2*/\n//# sourceURL=foo-js-after",
- 'expected_tag' => "\n",
+ 'expected_tag' => "\n",
),
);
}
@@ -2867,7 +2863,7 @@ public function test_wp_set_script_translations() {
wp_enqueue_script( 'test-example', '/wp-includes/js/script.js', array(), null );
wp_set_script_translations( 'test-example', 'default', DIR_TESTDATA . '/languages' );
- $expected = "\n";
+ $expected = "\n";
$expected .= str_replace(
array(
'__DOMAIN__',
@@ -2881,7 +2877,7 @@ public function test_wp_set_script_translations() {
),
$this->wp_scripts_print_translations_output
);
- $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2899,7 +2895,7 @@ public function test_wp_set_script_translations_uses_registered_domainpath_for_p
$wp_textdomain_registry->set_custom_path( 'internationalized-plugin', DIR_TESTDATA . '/languages/plugins' );
wp_set_script_translations( 'domain-path-plugin', 'internationalized-plugin' );
- $expected = "\n";
+ $expected = "\n";
$expected .= str_replace(
array(
'__DOMAIN__',
@@ -2913,7 +2909,7 @@ public function test_wp_set_script_translations_uses_registered_domainpath_for_p
),
$this->wp_scripts_print_translations_output
);
- $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2934,7 +2930,7 @@ public function test_wp_set_script_translations_prefers_human_readable_filename_
$wp_textdomain_registry->set_custom_path( 'admin', DIR_TESTDATA . '/languages' );
wp_set_script_translations( 'script-handle', 'admin' );
- $expected = "\n";
+ $expected = "\n";
$expected .= str_replace(
array(
'__DOMAIN__',
@@ -2948,7 +2944,7 @@ public function test_wp_set_script_translations_prefers_human_readable_filename_
),
$this->wp_scripts_print_translations_output
);
- $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2961,7 +2957,7 @@ public function test_wp_set_script_translations_for_plugin() {
wp_enqueue_script( 'plugin-example', '/wp-content/plugins/my-plugin/js/script.js', array(), null );
wp_set_script_translations( 'plugin-example', 'internationalized-plugin', DIR_TESTDATA . '/languages/plugins' );
- $expected = "\n";
+ $expected = "\n";
$expected .= str_replace(
array(
'__DOMAIN__',
@@ -2975,7 +2971,7 @@ public function test_wp_set_script_translations_for_plugin() {
),
$this->wp_scripts_print_translations_output
);
- $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -2988,7 +2984,7 @@ public function test_wp_set_script_translations_for_theme() {
wp_enqueue_script( 'theme-example', '/wp-content/themes/my-theme/js/script.js', array(), null );
wp_set_script_translations( 'theme-example', 'internationalized-theme', DIR_TESTDATA . '/languages/themes' );
- $expected = "\n";
+ $expected = "\n";
$expected .= str_replace(
array(
'__DOMAIN__',
@@ -3002,7 +2998,7 @@ public function test_wp_set_script_translations_for_theme() {
),
$this->wp_scripts_print_translations_output
);
- $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -3015,7 +3011,7 @@ public function test_wp_set_script_translations_with_handle_file() {
wp_enqueue_script( 'script-handle', '/wp-admin/js/script.js', array(), null );
wp_set_script_translations( 'script-handle', 'admin', DIR_TESTDATA . '/languages/' );
- $expected = "\n";
+ $expected = "\n";
$expected .= str_replace(
array(
'__DOMAIN__',
@@ -3029,7 +3025,7 @@ public function test_wp_set_script_translations_with_handle_file() {
),
$this->wp_scripts_print_translations_output
);
- $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -3058,8 +3054,8 @@ public function test_wp_set_script_translations_when_translation_file_does_not_e
wp_enqueue_script( 'test-example', '/wp-admin/js/script.js', array(), null );
wp_set_script_translations( 'test-example', 'admin', DIR_TESTDATA . '/languages/' );
- $expected = "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -3074,7 +3070,7 @@ public function test_wp_set_script_translations_after_register() {
wp_enqueue_script( 'test-example' );
- $expected = "\n";
+ $expected = "\n";
$expected .= str_replace(
array(
'__DOMAIN__',
@@ -3088,7 +3084,7 @@ public function test_wp_set_script_translations_after_register() {
),
$this->wp_scripts_print_translations_output
);
- $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -3103,7 +3099,7 @@ public function test_wp_set_script_translations_dependency() {
wp_enqueue_script( 'test-example', '/wp-includes/js/script2.js', array( 'test-dependency' ), null );
- $expected = "\n";
+ $expected = "\n";
$expected .= str_replace(
array(
'__DOMAIN__',
@@ -3117,8 +3113,8 @@ public function test_wp_set_script_translations_dependency() {
),
$this->wp_scripts_print_translations_output
);
- $expected .= "\n";
- $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -3506,8 +3502,8 @@ public function test_wp_localize_script_data_formats( $l10n_data, $expected ) {
wp_enqueue_script( 'test-example', 'example.com', array(), null );
wp_localize_script( 'test-example', 'testExample', $l10n_data );
- $expected = "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
@@ -3570,9 +3566,9 @@ static function () {
);
// The non-default script should end concatenation and maintain order.
- $expected = "\n";
- $expected .= "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, $print_scripts );
}
@@ -3698,8 +3694,8 @@ public function data_provider_script_move_to_footer() {
},
'expected_header' => '',
'expected_footer' => '
-
-
+
+
',
'expected_in_footer' => array(
'script-a',
@@ -3719,8 +3715,8 @@ public function data_provider_script_move_to_footer() {
},
'expected_header' => '',
'expected_footer' => '
-
-
+
+
',
'expected_in_footer' => array(
'script-a',
@@ -3739,8 +3735,8 @@ 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' => false ) );
},
'expected_header' => '
-
-
+
+
',
'expected_footer' => '',
'expected_in_footer' => array(),
@@ -3766,10 +3762,10 @@ public function data_provider_script_move_to_footer() {
);
},
'expected_header' => '
-
+
',
'expected_footer' => '
-
+
',
'expected_in_footer' => array(
'script-b',
@@ -3816,12 +3812,12 @@ public function data_provider_script_move_to_footer() {
);
},
'expected_header' => '
-
-
+
+
',
'expected_footer' => '
-
-
+
+
',
'expected_in_footer' => array(
'script-c',
@@ -3863,10 +3859,10 @@ public function data_provider_script_move_to_footer() {
},
'expected_header' => '',
'expected_footer' => '
-
-
-
-
+
+
+
+
',
'expected_in_footer' => array(
'script-a',
@@ -3910,12 +3906,12 @@ public function data_provider_script_move_to_footer() {
);
},
'expected_header' => '
-
-
+
+
',
'expected_footer' => '
-
-
+
+
',
'expected_in_footer' => array(
'script-c',
@@ -4206,7 +4202,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 = "";
$this->assertEqualHTML( $expected, $markup, '', 'Expected equal snapshot for wp_print_scripts() with version ' . var_export( $version, true ) . ":\n$markup" );
}
@@ -4227,7 +4223,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 = "";
$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 3828c8246e528..c1c11985190cf 100644
--- a/tests/phpunit/tests/dependencies/styles.php
+++ b/tests/phpunit/tests/dependencies/styles.php
@@ -68,13 +68,13 @@ public function test_wp_enqueue_style() {
wp_enqueue_style( 'registered-no-qs-handle-null-version-enqueued-with-qs?arg1=foo&arg2=bar' );
$ver = get_bloginfo( 'version' );
- $expected = "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
- $expected .= "\n";
+ $expected = "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+ $expected .= "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_styles' ) );
@@ -109,7 +109,7 @@ public function test_wp_enqueue_style_with_html5_support_does_not_contain_type_a
public function test_awkward_handles_are_supported_consistently( $handle ) {
wp_enqueue_style( $handle, 'example.com', array(), null );
- $expected = "\n";
+ $expected = "\n";
$this->assertEqualHTML( $expected, get_echo( 'wp_print_styles' ) );
}
@@ -145,24 +145,24 @@ public function test_protocols() {
// Try with an HTTP reference.
wp_enqueue_style( 'reset-css-http', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
- $expected .= "\n";
+ $expected .= "\n";
// Try with an HTTPS reference.
wp_enqueue_style( 'reset-css-https', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
- $expected .= "\n";
+ $expected .= "\n";
// Try with an automatic protocol reference (//).
wp_enqueue_style( 'reset-css-doubleslash', '//yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
- $expected .= "\n";
+ $expected .= "\n";
// Try with a local resource and an automatic protocol reference (//).
$url = '//my_plugin/style.css';
wp_enqueue_style( 'plugin-style', $url );
- $expected .= "\n";
+ $expected .= "\n";
// Try with a bad protocol.
wp_enqueue_style( 'reset-css-ftp', 'ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
- $expected .= "\n";
+ $expected .= "\n";
// Go!
$this->assertEqualHTML( $expected, get_echo( 'wp_print_styles' ) );
@@ -185,8 +185,8 @@ public function test_inline_styles() {
$style .= "\tbackground: red;\n";
$style .= '}';
- $expected = "\n";
- $expected .= "\n";
@@ -213,8 +213,8 @@ public function test_inline_styles_concat() {
$style .= "\tbackground: red;\n";
$style .= '}';
- $expected = "\n";
- $expected .= "\n";
@@ -307,8 +307,8 @@ public function test_multiple_inline_styles() {
$style2 .= "\tbackground: blue;\n";
$style2 .= '}';
- $expected = "\n";
- $expected .= "\n";
@@ -353,7 +353,7 @@ public function test_plugin_doing_inline_styles_wrong() {
*/
public function test_unnecessary_style_tags() {
- $expected = "\n";
+ $expected = "\n";
wp_enqueue_style( 'handle', 'http://example.com', array(), 1 );
@@ -391,9 +391,9 @@ public function test_wp_register_style() {
public function test_wp_add_inline_style_for_handle_without_source() {
$style = 'a { color: blue; }';
- $expected = "\n";
- $expected .= "\n";
- $expected .= "\n";
@@ -628,7 +628,7 @@ static function () use ( $styles_inline_size_limit ): int {
$this->assertTrue( $processor->next_tag() );
$this->assertSame( 'STYLE', $processor->get_tag() );
$this->assertSame( $handle . '-inline-css', $processor->get_attribute( 'id' ) );
- $this->assertSame( 'text/css', $processor->get_attribute( 'type' ) );
+ $this->assertNull( $processor->get_attribute( 'type' ) );
$expected_inline_styles = $expected_after;
if ( isset( $additional_inline_style ) ) {
@@ -777,8 +777,8 @@ public function test_source_url_encoding() {
wp_add_inline_style( $handle, 'custom-el { content: "ok"; }' );
$expected = <<
- #-css" media="all">
+
@@ -869,7 +869,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 = "";
$this->assertEqualHTML( $expected, $markup, '', 'Expected equal snapshot for wp_print_styles() with version ' . var_export( $version, true ) . ":\n$markup" );
}
@@ -890,7 +890,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 = "";
$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/dependencies/wpInlineScriptTag.php b/tests/phpunit/tests/dependencies/wpInlineScriptTag.php
index 9f3eb3c8cfb90..b67055213e710 100644
--- a/tests/phpunit/tests/dependencies/wpInlineScriptTag.php
+++ b/tests/phpunit/tests/dependencies/wpInlineScriptTag.php
@@ -143,7 +143,7 @@ public function test_get_inline_script_tag_with_duplicated_cdata_wrappers() {
remove_theme_support( 'html5' );
$this->assertSame(
- "\n",
+ "\n",
wp_get_inline_script_tag( "/* */" )
);
}
diff --git a/tests/phpunit/tests/fonts/font-face/wpFontFace/generateAndPrint.php b/tests/phpunit/tests/fonts/font-face/wpFontFace/generateAndPrint.php
index a6454c11d1883..c0d314d0ab4d8 100644
--- a/tests/phpunit/tests/fonts/font-face/wpFontFace/generateAndPrint.php
+++ b/tests/phpunit/tests/fonts/font-face/wpFontFace/generateAndPrint.php
@@ -31,7 +31,7 @@ public function test_should_not_generate_and_print_when_no_fonts() {
*/
public function test_should_generate_and_print_given_fonts( array $fonts, $expected ) {
$font_face = new WP_Font_Face();
- $style_element = "\n";
+ $style_element = "\n";
$expected_output = sprintf( $style_element, $expected );
$output = get_echo( array( $font_face, 'generate_and_print' ), array( $fonts ) );
diff --git a/tests/phpunit/tests/fonts/font-face/wpPrintFontFaces.php b/tests/phpunit/tests/fonts/font-face/wpPrintFontFaces.php
index 71cd964ca1bd8..a1fea3ac948e2 100644
--- a/tests/phpunit/tests/fonts/font-face/wpPrintFontFaces.php
+++ b/tests/phpunit/tests/fonts/font-face/wpPrintFontFaces.php
@@ -55,7 +55,7 @@ public function test_should_escape_tags() {
);
$expected_output = <<
+
@@ -76,7 +76,7 @@ public function test_should_print_fonts_in_merged_data() {
}
private function get_expected_styles_output( $styles ) {
- $style_element = "\n";
+ $style_element = "\n";
return sprintf( $style_element, $styles );
}
}
diff --git a/tests/phpunit/tests/fonts/font-face/wpPrintFontFacesFromStyleVariations.php b/tests/phpunit/tests/fonts/font-face/wpPrintFontFacesFromStyleVariations.php
index 5dd6304fd2f7b..664404d552b45 100644
--- a/tests/phpunit/tests/fonts/font-face/wpPrintFontFacesFromStyleVariations.php
+++ b/tests/phpunit/tests/fonts/font-face/wpPrintFontFacesFromStyleVariations.php
@@ -48,7 +48,7 @@ public function test_should_print_fonts_in_style_variations() {
}
private function get_expected_styles_output( $styles ) {
- $style_element = "\n";
+ $style_element = "\n";
return sprintf( $style_element, $styles );
}
}
diff --git a/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php b/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php
index 5e69efac966f0..2c5ad1f513744 100644
--- a/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php
+++ b/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php
@@ -331,7 +331,7 @@ public function test_html_contents( $groups, array $expected_content = array() )
$expected .= "\n";
$expected .= "\n";
$expected .= "\n";
- $expected .= "Personal Data Export for {$request->email}\n";
+ $expected .= "Personal Data Export for {$request->email}\n";
$expected .= "\n";
$expected .= 'Personal Data Export
';