Fix unit tests.

Only require autoloader in uninstall if WooCommerce Admin class hasn't been loaded.
This commit is contained in:
Jeff Stieler 2020-01-17 10:32:17 -07:00
parent 3cf9d76ed4
commit d51aab231e
1 changed files with 5 additions and 3 deletions

View File

@ -32,10 +32,12 @@ if ( Constants::is_true( 'WC_REMOVE_ALL_DATA' ) ) {
* Load core packages autoloader.
*/
if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) {
require __DIR__ . '/src/Autoloader.php';
if ( ! class_exists( 'Automattic\WooCommerce\Admin\Install' ) ) {
require __DIR__ . '/src/Autoloader.php';
if ( ! \Automattic\WooCommerce\Autoloader::init() ) {
return;
if ( ! \Automattic\WooCommerce\Autoloader::init() ) {
return;
}
}
// Hook in WooCommerce Admin installation code.