mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 13:51:44 +00:00
feat: rough session re-implementation
This commit is contained in:
@@ -689,3 +689,15 @@
|
||||
expect($this->cart->getTotalQuantity())->toBeInt('Return type should be INT');
|
||||
expect($this->cart->getTotalQuantity())->toEqual(12, 'Cart\'s quantity should be 4.');
|
||||
});
|
||||
|
||||
test('can add to cart and then update the session key', function () {
|
||||
$this->cart->add(1, 'Sample Item', 100.99, 2, []);
|
||||
|
||||
expect($this->cart->getContent()->count())->toEqual(1, 'Cart content should be 1');
|
||||
expect($this->cart->getContent()->first()['id'])->toEqual(1, 'Item added has ID of 1 so first content ID should be 1');
|
||||
|
||||
$this->cart->setSessionKey('new_session_key');
|
||||
|
||||
expect($this->cart->getSessionKey())->toEqual('new_session_key', 'Session key should be updated to new_session_key');
|
||||
expect($this->cart->getContent()->count())->toEqual(1, 'Cart content should still be 1');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user