Skip to content

Commit

Permalink
added more classes to the classmap & removed some more includes
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Mar 29, 2023
1 parent f789ec7 commit f519144
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/wp-admin/includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -1779,8 +1779,6 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {

mbstring_binary_safe_encoding();

require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';

$archive = new PclZip( $file );

$archive_files = $archive->extract( PCLZIP_OPT_EXTRACT_AS_STRING );
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/class-wp-autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ final class WP_Autoload {
/* Classes in the wp-includes/ folder. */
'passwordhash' => 'wp-includes/class-phpass.php',
'pop3' => 'wp-includes/class-pop3.php',
'services_json' => 'wp-includes/class-json.php',
'services_json_error' => 'wp-includes/class-json.php',
'walker_categorydropdown' => 'wp-includes/class-walker-category-dropdown.php',
'walker_category' => 'wp-includes/class-walker-category.php',
'walker_comment' => 'wp-includes/class-walker-comment.php',
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/admin/wpAutomaticUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Tests_Admin_WpAutomaticUpdater extends WP_UnitTestCase {
* Sets up shared fixtures.
*/
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php';
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' );
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/admin/wpCommunityEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Tests_Admin_wpCommunityEvents extends WP_UnitTestCase {
public static function set_up_before_class() {
parent::set_up_before_class();

require_once ABSPATH . 'wp-admin/includes/class-wp-community-events.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/admin/wpListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static function set_up_before_class() {

parent::set_up_before_class();

require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';

$hook_suffix = '_wp_tests';
self::$list_table = new WP_List_Table();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/admin/wpMediaListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Tests_Admin_wpMediaListTable extends WP_UnitTestCase {
public static function set_up_before_class() {
parent::set_up_before_class();

require_once ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';
}

/**
Expand Down
3 changes: 1 addition & 2 deletions tests/phpunit/tests/adminbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Tests_AdminBar extends WP_UnitTestCase {
public static function set_up_before_class() {
parent::set_up_before_class();

require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';
}

public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
Expand Down Expand Up @@ -651,7 +651,6 @@ public function test_new_user_link_does_not_exist_for_user_without_create_or_pro
*/
public function test_customize_link() {
global $wp_customize;
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
$uuid = wp_generate_uuid4();
$this->go_to( home_url( "/?customize_changeset_uuid=$uuid" ) );
wp_set_current_user( self::$admin_id );
Expand Down
3 changes: 1 addition & 2 deletions tests/phpunit/tests/ajax/wpAjaxCropImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* Admin Ajax functions to be tested.
*/
require_once ABSPATH . 'wp-admin/includes/ajax-actions.php';
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php';
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php';
require_once ABSPATH . 'wp-includes/class-wp-autoload.php';

/**
* Class for testing ajax crop image functionality.
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/ajax/wpCustomizeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
*/
public function set_up() {
parent::set_up();
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/ajax/wpCustomizeNavMenus.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
*/
public function set_up() {
parent::set_up();
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
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();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/compat/jsonEncodeDecode.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function test_json_encode_decode() {
$this->setExpectedDeprecated( 'Services_JSON::strlen8' );
$this->setExpectedDeprecated( 'Services_JSON::substr8' );

require_once ABSPATH . WPINC . '/class-json.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';
$json = new Services_JSON();

// Super basic test to verify Services_JSON is intact and working.
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/customize/control.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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-customize-manager.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
$this->wp_customize = $GLOBALS['wp_customize'];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/customize/custom-css-setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Test_WP_Customize_Custom_CSS_Setting extends WP_UnitTestCase {
*/
public function set_up() {
parent::set_up();
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';

$user_id = self::factory()->user->create(
array(
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/tests/customize/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
*/
public function set_up() {
parent::set_up();
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';
$this->manager = $this->instantiate();
}

Expand Down Expand Up @@ -3638,7 +3638,7 @@ public function test_sanitize_external_header_video_trim() {
}
}

require_once ABSPATH . WPINC . '/class-wp-customize-setting.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';

/**
* Class Test_Dynamic_Customize_Setting
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ 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-customize-manager.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';
$wp_customize = new WP_Customize_Manager();
do_action( 'customize_register', $wp_customize );

Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ 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-customize-manager.php';
require_once ABSPATH . WPINC . '/class-wp-autoload.php';
$wp_customize = new WP_Customize_Manager();
$wp_customize->start_previewing_theme();

Expand Down

0 comments on commit f519144

Please sign in to comment.