undo extra changes

This commit is contained in:
Joel Male
2024-09-04 09:14:23 +10:00
parent 05318b7b13
commit 7ee26add8d
2 changed files with 5 additions and 111 deletions
+1 -31
View File
@@ -1256,36 +1256,6 @@
expect($this->cart->get(1)->getPriceSumWithConditions())->toEqual(0.00, "The item's price should be prevented from going below zero.");
});
test('can be removed by name when calling removeCondition with clearItemConditions: true', function () {
$itemCondition = new CartCondition([
'name' => 'Item Discount',
'type' => 'discount',
'value' => '-5%',
]);
$item = [
'id' => 1,
'name' => 'Backpack',
'price' => 168.72,
'quantity' => 1,
'attributes' => [],
'conditions' => [$itemCondition],
];
$this->cart->add($item);
expect($this->cart->getConditions())->toHaveCount(0, 'Cart should have no conditions');
expect($this->cart->get(1)['conditions'])->toHaveCount(1, 'Cart item should have one condition');
$this->cart->removeCondition(
conditionName: 'Item Discount',
clearItemConditions: true
);
expect($this->cart->getConditions()->count())->toEqual(0, 'Cart should have no conditions now');
expect($this->cart->get(1)['conditions'])->toHaveCount(0, 'Cart items should have no conditions now');
});
test('can be removed by condition name', function () {
$heavyItemSurcharge = new CartCondition([
'name' => 'Heavy Item Surcharge',
@@ -1315,7 +1285,7 @@
$this->cart->removeItemCondition(12, 'Tax');
expect($this->cart->get(12)['conditions'])->toHaveCount(1, 'Item should have one condition');
})->only();
});
// test('remove item condition by condition name scenario two', function () {
// // NOTE: in this scenario, we will add the conditions not in array format