mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 22:01:48 +00:00
chore: merge master, resolve conflicts keeping v3
This commit is contained in:
@@ -159,4 +159,23 @@
|
|||||||
expect($this->cart->getContent()->count())->toEqual(0, 'Cart content should be 0');
|
expect($this->cart->getContent()->count())->toEqual(0, 'Cart content should be 0');
|
||||||
expect(MockCartModel::all()->count())->toEqual(0, 'The carts database table should have 0 rows');
|
expect(MockCartModel::all()->count())->toEqual(0, 'The carts database table should have 0 rows');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('can clear cart conditions after clearing the cart', function () {
|
||||||
|
$condition = new CartCondition([
|
||||||
|
'name' => '10% Off',
|
||||||
|
'type' => 'coupon',
|
||||||
|
'target' => 'subtotal',
|
||||||
|
'value' => '-10%',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->cart->add(1, 'Sample Item', 100.99, 2, []);
|
||||||
|
$this->cart->condition($condition);
|
||||||
|
|
||||||
|
$this->cart->clear();
|
||||||
|
|
||||||
|
// This was throwing "Call to a member function save() on array"
|
||||||
|
// because clear() replaced $this->session with a plain array
|
||||||
|
expect(fn () => $this->cart->clearCartConditions())->not->toThrow(Error::class);
|
||||||
|
expect($this->cart->getConditions())->toBeEmpty();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user