mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 13:51:44 +00:00
feat: make SessionDriver constructor args optional with app() defaults
new SessionDriver() now works out of the box in a Laravel app, resolving the session and session ID from the container. Explicit args still work as before. Also ignores .claude/ directory from version control.
This commit is contained in:
@@ -71,6 +71,16 @@
|
||||
expect($this->driver->getSessionModel())->toBeNull();
|
||||
});
|
||||
|
||||
test('accepts explicit session and key, using them directly', function () {
|
||||
$session = new SessionMock;
|
||||
$driver = new SessionDriver($session, 'explicit-key');
|
||||
|
||||
$driver->putItems([['id' => 1]]);
|
||||
|
||||
expect($driver->getSessionKey())->toBe('explicit-key');
|
||||
expect($driver->getItems())->toBe([['id' => 1]]);
|
||||
});
|
||||
|
||||
test('setSessionKey on empty cart does not write null to session', function () {
|
||||
$this->driver->setSessionKey('new-key');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user