Coding Standards: Remove extra slashes when concatenating ABSPATH with a path.

Since `ABSPATH` is defined and documented to end with a forward slash `/`, this changeset removes the first `/` from strings appended to `ABSPATH` in various files, leading to `//` in the resulting path.

Props TobiasBg, audrasjb, SergeyBiryukov, emanuelx.
Fixes #57074.
See #57071.


git-svn-id: https://develop.svn.wordpress.org/trunk@54872 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras
2022-11-24 22:09:39 +00:00
parent bb948c5f6d
commit d19f5f0170
12 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -302,7 +302,7 @@ if ( isset( $GLOBALS['wp_tests_options'] ) ) {
}
// Load WordPress.
require_once ABSPATH . '/wp-settings.php';
require_once ABSPATH . 'wp-settings.php';
// Delete any default posts & related data.
_delete_all_posts();
+3 -3
View File
@@ -37,10 +37,10 @@ $_SERVER['PHP_SELF'] = '/index.php';
tests_add_filter( 'wp_die_handler', '_wp_die_handler_filter_exit' );
require_once ABSPATH . '/wp-settings.php';
require_once ABSPATH . 'wp-settings.php';
require_once ABSPATH . '/wp-admin/includes/upgrade.php';
require_once ABSPATH . '/wp-includes/class-wpdb.php';
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
require_once ABSPATH . 'wp-includes/class-wpdb.php';
// Override the PHPMailer.
global $phpmailer;
+1 -1
View File
@@ -556,7 +556,7 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
*/
private function get_test_widget_control_args() {
global $wp_registered_widgets;
require_once ABSPATH . '/wp-admin/includes/widgets.php';
require_once ABSPATH . 'wp-admin/includes/widgets.php';
$widget_id = 'search-2';
$widget = $wp_registered_widgets[ $widget_id ];
$args = array(
+2 -2
View File
@@ -19,8 +19,8 @@ class Tests_Feed_wpSimplePieFile extends WP_UnitTestCase {
public static function set_up_before_class() {
parent::set_up_before_class();
require_once ABSPATH . '/wp-includes/class-simplepie.php';
require_once ABSPATH . '/wp-includes/class-wp-simplepie-file.php';
require_once ABSPATH . 'wp-includes/class-simplepie.php';
require_once ABSPATH . 'wp-includes/class-wp-simplepie-file.php';
}
/**
+2 -2
View File
@@ -76,7 +76,7 @@ class Tests_Pluggable_Signatures extends WP_UnitTestCase {
*/
public function get_defined_pluggable_functions() {
require_once ABSPATH . '/wp-admin/includes/upgrade.php';
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$test_functions = array(
'install_network',
@@ -103,7 +103,7 @@ class Tests_Pluggable_Signatures extends WP_UnitTestCase {
}
foreach ( $test_files as $file ) {
preg_match_all( '#^\t?function (\w+)#m', file_get_contents( ABSPATH . '/' . $file ), $functions );
preg_match_all( '#^\t?function (\w+)#m', file_get_contents( ABSPATH . $file ), $functions );
foreach ( $functions[1] as $function ) {
$data[] = array(
+1 -1
View File
@@ -173,7 +173,7 @@ class Tests_Pluggable_wpMail extends WP_UnitTestCase {
$this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body' ) );
// Non-fatal errors.
$this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body', "Cc: invalid-address\nBcc: @invalid.address", ABSPATH . '/non-existent-file.html' ) );
$this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body', "Cc: invalid-address\nBcc: @invalid.address", ABSPATH . 'non-existent-file.html' ) );
// Fatal errors.
$this->assertFalse( wp_mail( 'invalid.address', 'subject', 'body', '', array() ) );
+1 -1
View File
@@ -48,7 +48,7 @@ http://wordpress.org/
public static function set_up_before_class() {
parent::set_up_before_class();
require_once ABSPATH . '/wp-includes/pomo/po.php';
require_once ABSPATH . 'wp-includes/pomo/po.php';
}
public function test_prepend_each_line() {
+1 -1
View File
@@ -285,7 +285,7 @@ class Tests_Post extends WP_UnitTestCase {
$this->markTestSkipped( 'This test is only useful with the utf8 character set.' );
}
require_once ABSPATH . '/wp-admin/includes/post.php';
require_once ABSPATH . 'wp-admin/includes/post.php';
$post_id = self::factory()->post->create();
+1 -1
View File
@@ -813,7 +813,7 @@ class Tests_Widgets extends WP_UnitTestCase {
);
wp_widgets_init();
require_once ABSPATH . '/wp-admin/includes/widgets.php';
require_once ABSPATH . 'wp-admin/includes/widgets.php';
$widget_id = 'search-2';
$widget = $wp_registered_widgets[ $widget_id ];
$params = array(