Fix product related tests after product CRUD merge

This commit is contained in:
Justin Shreve 2016-11-16 05:18:03 -08:00
parent 76b32c9aa5
commit 85cfe59988
2 changed files with 2 additions and 4 deletions

View File

@ -1368,7 +1368,8 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
// Thumbnail. // Thumbnail.
if ( isset( $data['image'] ) && is_array( $data['image'] ) ) { if ( isset( $data['image'] ) && is_array( $data['image'] ) ) {
$image = current( $data['image'] ); $image = $data['image'];
$image = current( $image );
if ( is_array( $image ) ) { if ( is_array( $image ) ) {
$image['position'] = 0; $image['position'] = 0;
} }

View File

@ -261,7 +261,6 @@ class WC_Tests_Product_Data_Store extends WC_Unit_Test_Case {
$this->assertEquals( 'Variation #1 of Dummy Variable CRUD Product', $variation->get_name() ); $this->assertEquals( 'Variation #1 of Dummy Variable CRUD Product', $variation->get_name() );
$this->assertEquals( 'CRUD DUMMY SKU VARIABLE GREEN', $variation->get_sku() ); $this->assertEquals( 'CRUD DUMMY SKU VARIABLE GREEN', $variation->get_sku() );
$this->assertEquals( 10, $variation->get_price() ); $this->assertEquals( 10, $variation->get_price() );
$product->delete();
$product = new WC_Product_Variable( $product->get_id() ); $product = new WC_Product_Variable( $product->get_id() );
$children = $product->get_children(); $children = $product->get_children();
@ -285,7 +284,6 @@ class WC_Tests_Product_Data_Store extends WC_Unit_Test_Case {
$this->assertEquals( 'Variation #2 of Dummy Variable CRUD Product', $variation_2->get_name() ); $this->assertEquals( 'Variation #2 of Dummy Variable CRUD Product', $variation_2->get_name() );
$this->assertEquals( 'CRUD DUMMY SKU VARIABLE RED', $variation_2->get_sku() ); $this->assertEquals( 'CRUD DUMMY SKU VARIABLE RED', $variation_2->get_sku() );
$this->assertEquals( 10, $variation_2->get_price() ); $this->assertEquals( 10, $variation_2->get_price() );
$product->delete();
$product = new WC_Product_Variable( $product->get_id() ); $product = new WC_Product_Variable( $product->get_id() );
$children = $product->get_children(); $children = $product->get_children();
@ -300,7 +298,6 @@ class WC_Tests_Product_Data_Store extends WC_Unit_Test_Case {
$variation_2->set_sale_price( 9.99 ); $variation_2->set_sale_price( 9.99 );
$variation_2->set_date_on_sale_to( '32532537600' ); $variation_2->set_date_on_sale_to( '32532537600' );
$variation_2->save(); $variation_2->save();
$product->delete();
$product = new WC_Product_Variable( $product->get_id() ); $product = new WC_Product_Variable( $product->get_id() );
$expected_prices['price'][ $children[0] ] = 10.00; $expected_prices['price'][ $children[0] ] = 10.00;