From 81aabba0dd3e0eaee672a70e8ad10770473fe0f8 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 29 Mar 2023 12:15:45 +0300 Subject: [PATCH] cleanup tests --- tests/phpunit/tests/admin/wpAutomaticUpdater.php | 1 - tests/phpunit/tests/admin/wpCommunityEvents.php | 11 ----------- tests/phpunit/tests/admin/wpListTable.php | 2 -- tests/phpunit/tests/admin/wpMediaListTable.php | 6 ------ tests/phpunit/tests/admin/wpSiteHealth.php | 13 ------------- tests/phpunit/tests/adminbar.php | 6 ------ tests/phpunit/tests/ajax/wpAjaxCropImage.php | 1 - tests/phpunit/tests/ajax/wpCustomizeManager.php | 8 -------- tests/phpunit/tests/ajax/wpCustomizeNavMenus.php | 1 - tests/phpunit/tests/category/walkerCategory.php | 1 - tests/phpunit/tests/compat/jsonEncodeDecode.php | 1 - tests/phpunit/tests/customize/control.php | 1 - .../phpunit/tests/customize/custom-css-setting.php | 1 - tests/phpunit/tests/customize/manager.php | 3 --- tests/phpunit/tests/oembed/wpOembed.php | 1 - tests/phpunit/tests/post/walkerPage.php | 1 - tests/phpunit/tests/theme.php | 1 - tests/phpunit/tests/widgets.php | 1 - 18 files changed, 60 deletions(-) diff --git a/tests/phpunit/tests/admin/wpAutomaticUpdater.php b/tests/phpunit/tests/admin/wpAutomaticUpdater.php index f8bc6a0904729..6cf790cfa74e8 100644 --- a/tests/phpunit/tests/admin/wpAutomaticUpdater.php +++ b/tests/phpunit/tests/admin/wpAutomaticUpdater.php @@ -25,7 +25,6 @@ class Tests_Admin_WpAutomaticUpdater extends WP_UnitTestCase { * Sets up shared fixtures. */ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; self::$updater = new WP_Automatic_Updater(); self::$send_plugin_theme_email = new ReflectionMethod( self::$updater, 'send_plugin_theme_email' ); diff --git a/tests/phpunit/tests/admin/wpCommunityEvents.php b/tests/phpunit/tests/admin/wpCommunityEvents.php index 811ecf88728f3..cbe549836faa9 100644 --- a/tests/phpunit/tests/admin/wpCommunityEvents.php +++ b/tests/phpunit/tests/admin/wpCommunityEvents.php @@ -20,17 +20,6 @@ class Tests_Admin_wpCommunityEvents extends WP_UnitTestCase { */ private $instance; - /** - * Performs setup tasks before the first test is run. - * - * @since 5.9.0 - */ - public static function set_up_before_class() { - parent::set_up_before_class(); - - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; - } - /** * Performs setup tasks for every test. * diff --git a/tests/phpunit/tests/admin/wpListTable.php b/tests/phpunit/tests/admin/wpListTable.php index 66599a57ca92b..4dd1bc3183ff9 100644 --- a/tests/phpunit/tests/admin/wpListTable.php +++ b/tests/phpunit/tests/admin/wpListTable.php @@ -19,8 +19,6 @@ public static function set_up_before_class() { parent::set_up_before_class(); - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; - $hook_suffix = '_wp_tests'; self::$list_table = new WP_List_Table(); } diff --git a/tests/phpunit/tests/admin/wpMediaListTable.php b/tests/phpunit/tests/admin/wpMediaListTable.php index d6d59761d4968..73783e4401745 100644 --- a/tests/phpunit/tests/admin/wpMediaListTable.php +++ b/tests/phpunit/tests/admin/wpMediaListTable.php @@ -5,12 +5,6 @@ */ class Tests_Admin_wpMediaListTable extends WP_UnitTestCase { - public static function set_up_before_class() { - parent::set_up_before_class(); - - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; - } - /** * Tests that a call to WP_Media_List_Table::prepare_items() on a site without any scheduled events * does not result in a PHP warning. diff --git a/tests/phpunit/tests/admin/wpSiteHealth.php b/tests/phpunit/tests/admin/wpSiteHealth.php index 908ba7965660e..3d07ca7731890 100644 --- a/tests/phpunit/tests/admin/wpSiteHealth.php +++ b/tests/phpunit/tests/admin/wpSiteHealth.php @@ -7,19 +7,6 @@ */ class Tests_Admin_wpSiteHealth extends WP_UnitTestCase { - /** - * An instance of the class to test. - * - * @since 6.1.0 - * - * @var WP_Site_Health - */ - private $instance; - - public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { - require_once ABSPATH . 'wp-includes/class-wp-autoload.php'; - } - /** * Performs setup tasks for every test. * diff --git a/tests/phpunit/tests/adminbar.php b/tests/phpunit/tests/adminbar.php index 6bbfd3c2b6102..f192b8f6d2df3 100644 --- a/tests/phpunit/tests/adminbar.php +++ b/tests/phpunit/tests/adminbar.php @@ -14,12 +14,6 @@ class Tests_AdminBar extends WP_UnitTestCase { protected static $user_ids = array(); - public static function set_up_before_class() { - parent::set_up_before_class(); - - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; - } - public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) ); self::$user_ids[] = self::$editor_id; diff --git a/tests/phpunit/tests/ajax/wpAjaxCropImage.php b/tests/phpunit/tests/ajax/wpAjaxCropImage.php index 3406c8d185e94..5b99d371b45f0 100644 --- a/tests/phpunit/tests/ajax/wpAjaxCropImage.php +++ b/tests/phpunit/tests/ajax/wpAjaxCropImage.php @@ -4,7 +4,6 @@ * Admin Ajax functions to be tested. */ require_once ABSPATH . 'wp-admin/includes/ajax-actions.php'; -require_once ABSPATH . 'wp-includes/class-wp-autoload.php'; /** * Class for testing ajax crop image functionality. diff --git a/tests/phpunit/tests/ajax/wpCustomizeManager.php b/tests/phpunit/tests/ajax/wpCustomizeManager.php index ff68d9d86c9c8..f04ec64b560ef 100644 --- a/tests/phpunit/tests/ajax/wpCustomizeManager.php +++ b/tests/phpunit/tests/ajax/wpCustomizeManager.php @@ -48,14 +48,6 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$admin_user_id = $factory->user->create( array( 'role' => 'administrator' ) ); } - /** - * Set up the test fixture. - */ - public function set_up() { - parent::set_up(); - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; - } - /** * Tear down. */ diff --git a/tests/phpunit/tests/ajax/wpCustomizeNavMenus.php b/tests/phpunit/tests/ajax/wpCustomizeNavMenus.php index 1db609ab06d80..486a735f65c88 100644 --- a/tests/phpunit/tests/ajax/wpCustomizeNavMenus.php +++ b/tests/phpunit/tests/ajax/wpCustomizeNavMenus.php @@ -52,7 +52,6 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { */ public function set_up() { parent::set_up(); - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); global $wp_customize; $this->wp_customize = new WP_Customize_Manager(); diff --git a/tests/phpunit/tests/category/walkerCategory.php b/tests/phpunit/tests/category/walkerCategory.php index 67847388f0bce..305528a58ebe2 100644 --- a/tests/phpunit/tests/category/walkerCategory.php +++ b/tests/phpunit/tests/category/walkerCategory.php @@ -18,7 +18,6 @@ class Tests_Category_Walker_Category extends WP_UnitTestCase { public function set_up() { parent::set_up(); - require_once ABSPATH . 'wp-includes/class-wp-autoload.php'; $this->walker = new Walker_Category(); } diff --git a/tests/phpunit/tests/compat/jsonEncodeDecode.php b/tests/phpunit/tests/compat/jsonEncodeDecode.php index 7c311868be0c9..a3d54abf8de37 100644 --- a/tests/phpunit/tests/compat/jsonEncodeDecode.php +++ b/tests/phpunit/tests/compat/jsonEncodeDecode.php @@ -18,7 +18,6 @@ public function test_json_encode_decode() { $this->setExpectedDeprecated( 'Services_JSON::strlen8' ); $this->setExpectedDeprecated( 'Services_JSON::substr8' ); - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; $json = new Services_JSON(); // Super basic test to verify Services_JSON is intact and working. diff --git a/tests/phpunit/tests/customize/control.php b/tests/phpunit/tests/customize/control.php index 88feca20a937f..4c4e1f09628a8 100644 --- a/tests/phpunit/tests/customize/control.php +++ b/tests/phpunit/tests/customize/control.php @@ -23,7 +23,6 @@ class Test_WP_Customize_Control extends WP_UnitTestCase { public function set_up() { parent::set_up(); wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; $GLOBALS['wp_customize'] = new WP_Customize_Manager(); $this->wp_customize = $GLOBALS['wp_customize']; } diff --git a/tests/phpunit/tests/customize/custom-css-setting.php b/tests/phpunit/tests/customize/custom-css-setting.php index 4f14cf9e5cc07..5584bf1fd1687 100644 --- a/tests/phpunit/tests/customize/custom-css-setting.php +++ b/tests/phpunit/tests/customize/custom-css-setting.php @@ -29,7 +29,6 @@ class Test_WP_Customize_Custom_CSS_Setting extends WP_UnitTestCase { */ public function set_up() { parent::set_up(); - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; $user_id = self::factory()->user->create( array( diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index d363c840ac2f6..d16fee99da813 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -55,7 +55,6 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { */ public function set_up() { parent::set_up(); - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; $this->manager = $this->instantiate(); } @@ -3638,8 +3637,6 @@ public function test_sanitize_external_header_video_trim() { } } -require_once ABSPATH . WPINC . '/class-wp-autoload.php'; - /** * Class Test_Dynamic_Customize_Setting * diff --git a/tests/phpunit/tests/oembed/wpOembed.php b/tests/phpunit/tests/oembed/wpOembed.php index 5dea790fa5fa8..04c8189728e28 100644 --- a/tests/phpunit/tests/oembed/wpOembed.php +++ b/tests/phpunit/tests/oembed/wpOembed.php @@ -14,7 +14,6 @@ class Tests_WP_oEmbed extends WP_UnitTestCase { public function set_up() { parent::set_up(); - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; $this->oembed = _wp_oembed_get_object(); $this->pre_oembed_result_filtered = false; diff --git a/tests/phpunit/tests/post/walkerPage.php b/tests/phpunit/tests/post/walkerPage.php index f5f36891bb85b..692a33dda962e 100644 --- a/tests/phpunit/tests/post/walkerPage.php +++ b/tests/phpunit/tests/post/walkerPage.php @@ -16,7 +16,6 @@ class Tests_Post_Walker_Page extends WP_UnitTestCase { public function set_up() { parent::set_up(); - require_once ABSPATH . 'wp-includes/class-wp-autoload.php'; $this->walker = new Walker_Page(); } diff --git a/tests/phpunit/tests/theme.php b/tests/phpunit/tests/theme.php index 34e9430a822a4..1dca6d77bf1b3 100644 --- a/tests/phpunit/tests/theme.php +++ b/tests/phpunit/tests/theme.php @@ -380,7 +380,6 @@ public function test_wp_keep_alive_customize_changeset_dependent_auto_drafts() { ), ); wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; $wp_customize = new WP_Customize_Manager(); do_action( 'customize_register', $wp_customize ); diff --git a/tests/phpunit/tests/widgets.php b/tests/phpunit/tests/widgets.php index 30a9a316492d8..11567fd1e04bc 100644 --- a/tests/phpunit/tests/widgets.php +++ b/tests/phpunit/tests/widgets.php @@ -638,7 +638,6 @@ public function test_wp_widget_is_preview() { $this->assertFalse( $widget->is_preview() ); wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); - require_once ABSPATH . WPINC . '/class-wp-autoload.php'; $wp_customize = new WP_Customize_Manager(); $wp_customize->start_previewing_theme();