2015-06-09 13:02:02 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Class Functions.
|
2015-06-09 13:02:02 +00:00
|
|
|
* @package WooCommerce\Tests\API
|
|
|
|
* @since 2.4
|
|
|
|
*/
|
2016-03-23 12:14:13 +00:00
|
|
|
class WC_Tests_API_Orders extends WC_API_Unit_Test_Case {
|
2015-06-09 13:02:02 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Test test_wc_api_order_get_variation_id_returns_correct_id.
|
2015-06-09 13:02:02 +00:00
|
|
|
*
|
|
|
|
* @since 2.4
|
|
|
|
*/
|
|
|
|
public function test_wc_api_order_get_variation_id_returns_correct_id() {
|
|
|
|
parent::setUp();
|
2016-03-23 12:14:13 +00:00
|
|
|
$product = WC_Helper_Product::create_variation_product();
|
2015-06-09 13:02:02 +00:00
|
|
|
$orders_api = WC()->api->WC_API_Orders;
|
|
|
|
|
|
|
|
$variation_id = $orders_api->get_variation_id( $product, array( 'size' => 'small' ) );
|
|
|
|
$this->assertSame( ( $product->id + 1 ), $variation_id );
|
|
|
|
|
|
|
|
$variation_id = $orders_api->get_variation_id( $product, array( 'size' => 'large' ) );
|
|
|
|
$this->assertSame( ( $product->id + 2 ), $variation_id );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|