Cat dashboard loading time (#34292)

Co-authored-by: Néstor Soriano <konamiman@konamiman.com>
This commit is contained in:
Ilja Zaglov 2022-10-26 10:12:42 +02:00 committed by GitHub
parent c6c2828f60
commit 332204723b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Improve the loading time of WooCommerce setup widget for large databases

View File

@ -187,7 +187,7 @@ if ( ! class_exists( 'WC_Admin_Dashboard_Setup', false ) ) :
return false; return false;
} }
if ( ! $this->get_task_list() || $this->get_task_list()->is_complete() || $this->get_task_list()->is_hidden() ) { if ( ! $this->get_task_list() || $this->get_task_list()->is_hidden() || $this->get_task_list()->is_complete() ) {
return false; return false;
} }

View File

@ -19,7 +19,7 @@ class WC_Admin_Dashboard_Setup_Test extends WC_Unit_Test_Case {
// Set default country to non-US so that 'payments' task gets added but 'woocommerce-payments' doesn't, // Set default country to non-US so that 'payments' task gets added but 'woocommerce-payments' doesn't,
// by default it won't be considered completed but we can manually change that as needed. // by default it won't be considered completed but we can manually change that as needed.
update_option( 'woocommerce_default_country', 'JP' ); update_option( 'woocommerce_default_country', 'JP' );
$password = wp_generate_password( 8, false, false ); $password = wp_generate_password( 8, false, false );
$this->admin = wp_insert_user( $this->admin = wp_insert_user(
array( array(
'user_login' => "test_admin$password", 'user_login' => "test_admin$password",
@ -88,11 +88,16 @@ class WC_Admin_Dashboard_Setup_Test extends WC_Unit_Test_Case {
* Tests widget does not display when task list is complete. * Tests widget does not display when task list is complete.
*/ */
public function test_widget_does_not_display_when_task_list_complete() { public function test_widget_does_not_display_when_task_list_complete() {
$task_list = new class { // phpcs:disable Squiz.Commenting
$task_list = new class() {
public function is_complete() { public function is_complete() {
return true; return true;
} }
public function is_hidden() {
return false;
}
}; };
// phpcs:enable Squiz.Commenting
$widget = $this->get_widget(); $widget = $this->get_widget();
$widget->set_task_list( $task_list ); $widget->set_task_list( $task_list );