diff --git a/plugins/woocommerce/changelog/fix-34745-update-industries-error b/plugins/woocommerce/changelog/fix-34745-update-industries-error new file mode 100644 index 00000000000..08e934a58e9 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-34745-update-industries-error @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fix failing to update onboarding profile data for PHP 8 diff --git a/plugins/woocommerce/src/Admin/API/OnboardingProfile.php b/plugins/woocommerce/src/Admin/API/OnboardingProfile.php index 0c172fe68fb..44831382f1d 100644 --- a/plugins/woocommerce/src/Admin/API/OnboardingProfile.php +++ b/plugins/woocommerce/src/Admin/API/OnboardingProfile.php @@ -443,7 +443,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller { 'description' => __( 'Whether or not this store country is set via onboarding profiler.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, - 'validate_callback' => array( __CLASS__, 'rest_validate_request_arg' ), + 'validate_callback' => 'rest_validate_request_arg', ), ); diff --git a/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-profile.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-profile.php index 70d5986bcae..791b1554b34 100644 --- a/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-profile.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-profile.php @@ -67,7 +67,31 @@ class WC_Admin_Tests_API_Onboarding_Profiles extends WC_REST_Unit_Test_Case { 'slug' => 'health-beauty', ), ); - $request->set_body( wp_json_encode( array( 'industry' => $industry ) ) ); + $request->set_body( + wp_json_encode( + array( + 'completed' => true, + 'skipped' => false, + 'industry' => $industry, + 'product_types' => 'physical', + 'product_count' => '1-10', + 'selling_venues' => 'brick-mortar', + 'number_employees' => '<10', + 'revenue' => 'none', + 'other_platform' => 'shopify', + 'other_platform_name' => '', + 'business_extensions' => array( + 'jetpack', + ), + 'theme' => 'Test', + 'wccom_connected' => false, + 'setup_client' => false, + 'is_agree_marketing' => true, + 'store_email' => 'user@example.com', + 'is_store_country_set' => true, + ) + ) + ); $response = $this->server->dispatch( $request ); $data = $response->get_data();