From 077c489cafa86c5d770822cf34c1dd3e60c75f89 Mon Sep 17 00:00:00 2001 From: vendidero Date: Mon, 23 Sep 2024 17:38:26 +0200 Subject: [PATCH] Revert tests. --- .../framework/helpers/class-wc-gzd-helper-product.php | 7 +------ tests/unit-tests/api/orders.php | 7 ------- tests/unit-tests/api/products.php | 10 ++++------ 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/tests/framework/helpers/class-wc-gzd-helper-product.php b/tests/framework/helpers/class-wc-gzd-helper-product.php index 4b94f973b..d118576b9 100644 --- a/tests/framework/helpers/class-wc-gzd-helper-product.php +++ b/tests/framework/helpers/class-wc-gzd-helper-product.php @@ -106,7 +106,7 @@ public static function create_simple_product() { $allergen = self::create_allergen(); $nutrient = self::create_nutrient(); $manufacturer = self::create_manufacturer(); - $attachment = self::create_attachment(); + // $attachment = self::create_attachment(); $product = WC_Helper_Product::create_simple_product(); @@ -157,10 +157,6 @@ public static function create_simple_product() { 'ref_value' => 22.1, ), ), - '_safety_attachment_ids' => array( - $attachment - ), - '_warranty_attachment_id' => $attachment, '_allergen_ids' => array( $allergen->term_id, ), @@ -188,7 +184,6 @@ public static function create_variation_product() { $allergen = self::create_allergen(); $nutrient = self::create_nutrient(); $manufacturer = self::create_manufacturer(); - $attachment = self::create_attachment(); $data = array( '_unit' => 'g', diff --git a/tests/unit-tests/api/orders.php b/tests/unit-tests/api/orders.php index 4fe206d53..d01b98d1b 100644 --- a/tests/unit-tests/api/orders.php +++ b/tests/unit-tests/api/orders.php @@ -17,9 +17,6 @@ public function setUp() : void { $this->user = $this->factory->user->create( array( 'role' => 'administrator', ) ); - tests_add_action( 'doing_it_wrong_run', function() { - debug_print_backtrace(); - } ); } /** @@ -30,10 +27,6 @@ public function setUp() : void { public function test_get_order() { wp_set_current_user( $this->user ); - tests_add_action( 'doing_it_wrong_run', function() { - debug_print_backtrace(); - } ); - $order = WC_GZD_Helper_Order::create_order(); $response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v3/orders/' . $order->get_id() ) ); $order = $response->get_data(); diff --git a/tests/unit-tests/api/products.php b/tests/unit-tests/api/products.php index 196728131..de5ba0e04 100644 --- a/tests/unit-tests/api/products.php +++ b/tests/unit-tests/api/products.php @@ -44,7 +44,6 @@ public function test_get_product() { $this->assertEquals( '3-4-days', $country_specific[1]['slug'] ); $this->assertEquals( 'BG', $country_specific[1]['country'] ); - $this->assertEquals( 'vendidero', $product['manufacturer']['slug'] ); $this->assertEquals( '1', $product['unit_price']['product'] ); $this->assertEquals( '100.0', $product['unit_price']['price_regular'] ); @@ -62,8 +61,8 @@ public function test_get_product() { $this->assertEquals( true, $product['free_shipping'] ); $this->assertEquals( true, $product['is_food'] ); - $this->assertEquals( true, ! empty( $product['safety_attachment_ids'] ) ); - $this->assertEquals( true, ! empty( $product['warranty_attachment_id'] ) ); + // $this->assertEquals( true, ! empty( $product['safety_attachment_ids'] ) ); + // $this->assertEquals( true, ! empty( $product['warranty_attachment_id'] ) ); $nutrient = get_term_by( 'slug', 'energy', 'product_nutrient' ); $allergen = get_term_by( 'slug', 'hazelnut', 'product_allergen' ); @@ -102,7 +101,7 @@ public function test_create_product() { $nutrient = wp_insert_term( 'Salt', 'product_nutrient', array( 'slug' => 'salt' ) ); $nutrient_2 = wp_insert_term( 'Natrium', 'product_nutrient', array( 'slug' => 'natrium' ) ); $allergen = wp_insert_term( 'Nut', 'product_allergen', array( 'slug' => 'nut' ) ); - $attachment_id = WC_GZD_Helper_Product::create_attachment( 'test' ); + // $attachment_id = WC_GZD_Helper_Product::create_attachment( 'test' ); // Create simple. $request = new WP_REST_Request( 'POST', '/wc/v3/products' ); @@ -118,7 +117,6 @@ public function test_create_product() { 'mpn' => 'test_mpn', 'delivery_time' => array( 'id' => $term['term_id'] ), 'manufacturer' => array( 'id' => $manufacturer['term_id'] ), - 'safety_attachment_ids' => array( $attachment_id ), 'country_specific_delivery_times' => array( array( 'slug' => '4-5-days', @@ -171,7 +169,7 @@ public function test_create_product() { $this->assertEquals( '70.0', $data['unit_price']['price_sale'] ); $this->assertEquals( 'woocommerce', $data['manufacturer']['slug'] ); - $this->assertEquals( array( $attachment_id ), $data['safety_attachment_ids'] ); + // $this->assertEquals( array( $attachment_id ), $data['safety_attachment_ids'] ); $this->assertEquals( 'test_gtin', $data['gtin'] ); $this->assertEquals( 'test_mpn', $data['mpn'] );