woocommerce/tests/unit-tests/api/orders.php

29 lines
741 B
PHP
Raw Normal View History

<?php
/**
2015-11-03 13:31:20 +00:00
* Class Functions.
* @package WooCommerce\Tests\API
* @since 2.4
*/
class WC_Tests_API_Orders extends WC_API_Unit_Test_Case {
/**
2015-11-03 13:31:20 +00:00
* Test test_wc_api_order_get_variation_id_returns_correct_id.
*
* @since 2.4
*/
public function test_wc_api_order_get_variation_id_returns_correct_id() {
parent::setUp();
$product = WC_Helper_Product::create_variation_product();
$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 );
}
}