Fix failing to update onboarding profile data for PHP 8 (#34832)

* Fix failing to update industries

* Add changelog

* Update changelog

* Update onboarding profile unit tests to test all schema fields
This commit is contained in:
Chi-Hsuan Huang 2022-09-27 13:50:16 +08:00 committed by GitHub
parent c0fe3ec18f
commit ab484e579b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 2 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix failing to update onboarding profile data for PHP 8

View File

@ -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',
),
);

View File

@ -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();