/** * Setup test webhook data. * * @see WC_API_UnitTestCase::setup() * @since 2.2 */ public function setUp() { parent::setUp(); $this->endpoint = WC()->api->WC_API_Webhooks; // mock webhook $this->webhook = $this->factory->webhook->create_and_get(); // mock webhook delivery $this->webhook_delivery_id = $this->factory->webhook_delivery->create(array('comment_post_ID' => $this->webhook->id)); }
/** * 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); }
/** * Setup test coupon data. * @see WC_API_UnitTestCase::setup() * @since 2.7.0 */ public function setUp() { parent::setUp(); $this->endpoint = WC()->api->WC_API_Coupons; $this->coupon = WC_Helper_Coupon::create_coupon(); }