Skip to content

Commit

Permalink
Revert tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisnissle committed Sep 23, 2024
1 parent bddfa95 commit 077c489
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
7 changes: 1 addition & 6 deletions tests/framework/helpers/class-wc-gzd-helper-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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,
),
Expand Down Expand Up @@ -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',
Expand Down
7 changes: 0 additions & 7 deletions tests/unit-tests/api/orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
} );
}

/**
Expand All @@ -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();
Expand Down
10 changes: 4 additions & 6 deletions tests/unit-tests/api/products.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] );
Expand All @@ -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' );
Expand Down Expand Up @@ -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' );
Expand All @@ -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',
Expand Down Expand Up @@ -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'] );
Expand Down

0 comments on commit 077c489

Please sign in to comment.