diff --git a/tests/legacy/unit-tests/rest-api/Tests/Version2/product-variations.php b/tests/legacy/unit-tests/rest-api/Tests/Version2/product-variations.php index 22a53d4d829..560e88693ad 100644 --- a/tests/legacy/unit-tests/rest-api/Tests/Version2/product-variations.php +++ b/tests/legacy/unit-tests/rest-api/Tests/Version2/product-variations.php @@ -7,6 +7,7 @@ */ class Product_Variations_API_V2 extends WC_REST_Unit_Test_Case { + use WC_REST_API_Complex_Meta; /** * Setup our test server, endpoints, and user info. @@ -299,6 +300,19 @@ class Product_Variations_API_V2 extends WC_REST_Unit_Test_Case { $this->assertEquals( 3, count( $variations ) ); } + /** + * Test updating complex meta object. + */ + public function test_update_complex_meta_27282() { + wp_set_current_user( $this->user ); + $product = \Automattic\WooCommerce\RestApi\UnitTests\Helpers\ProductHelper::create_variation_product(); + $product->save(); + $variations = $product->get_available_variations( 'objects' ); + $first_variation_id = $variations[0]->get_id(); + $url = '/wc/v2/products/' . $product->get_id() . '/variations/' . $first_variation_id; + $this->assert_update_complex_meta( $url ); + } + /** * Test creating a single variation without permission. *