Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit 9441a5c

Browse files
committed
Add test to verify simple products are unchanged
1 parent a0365c1 commit 9441a5c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/unit/test-wcs-order-functions.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,5 +385,20 @@ public function test_wcs_set_recurring_item_total() {
385385

386386
$this->assertEquals( 40, $line_item->get_total() );
387387
$this->assertEquals( 40, $line_item->get_subtotal() );
388+
389+
/**
390+
* Simple product
391+
*/
392+
$simple_product = WC_Helper_Product::create_simple_product();
393+
394+
$line_item->set_product( $simple_product );
395+
$line_item->set_quantity( 1 );
396+
$line_item->set_total( 50 ); // Default price is $10.00. We set it to $50 here to confirm it's not changed.
397+
$line_item->set_subtotal( 50 );
398+
399+
wcs_set_recurring_item_total( $line_item );
400+
401+
$this->assertEquals( 50, $line_item->get_total() );
402+
$this->assertEquals( 50, $line_item->get_subtotal() );
388403
}
389404
}

0 commit comments

Comments
 (0)