Use the LegacyProxy to invoke get_plugins, remove CodeHacking usage

This commit is contained in:
Corey McKrill 2023-07-25 11:07:52 -07:00
parent faa478d610
commit d513c7c73e
No known key found for this signature in database
GPG Key ID: 84BBFE669C4D97B8
3 changed files with 3 additions and 4 deletions

View File

@ -14,6 +14,7 @@ use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore;
use Automattic\WooCommerce\Utilities\{ FeaturesUtil, OrderUtil, PluginUtil };
use Automattic\WooCommerce\Internal\Utilities\BlocksUtil;
use Automattic\WooCommerce\Proxies\LegacyProxy;
defined( 'ABSPATH' ) || exit;
@ -311,7 +312,7 @@ class WC_Tracker {
include ABSPATH . '/wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
$plugins = wc_get_container()->get( LegacyProxy::class )->call_function( 'get_plugins' );
$active_plugins_keys = get_option( 'active_plugins', array() );
$active_plugins = array();

View File

@ -10,7 +10,6 @@
return array(
'current_user_can',
'get_bloginfo',
'get_plugins',
'get_woocommerce_currencies',
'get_woocommerce_currency_symbol',
'wc_get_price_excluding_tax',

View File

@ -7,7 +7,6 @@
use Automattic\WooCommerce\Internal\Features\FeaturesController;
use Automattic\WooCommerce\Utilities\PluginUtil;
use Automattic\WooCommerce\Testing\Tools\CodeHacking\Hacks\FunctionsMockerHack;
// phpcs:disable Squiz.Classes.ClassFileName.NoMatch, Squiz.Classes.ValidClassName.NotCamelCaps -- Backward compatibility.
/**
@ -91,7 +90,7 @@ class WC_Tracker_Test extends \WC_Unit_Test_Case {
);
},
);
FunctionsMockerHack::add_function_mocks( $legacy_mocks );
$this->register_legacy_proxy_function_mocks( $legacy_mocks );
update_option( 'active_plugins', array( 'plugin1', 'plugin2' ) );