Skip to content

Commit

Permalink
Add test for variation v2 controller for complex meta object
Browse files Browse the repository at this point in the history
  • Loading branch information
vedanshujain committed Aug 13, 2020
1 parent 5c0be2a commit 4294e06
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -299,6 +300,19 @@ public function test_create_variation() {
$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.
*
Expand Down

0 comments on commit 4294e06

Please sign in to comment.