mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 22:01:48 +00:00
undo extra changes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user