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:
Joel Male
2026-05-28 09:25:41 +10:00
parent 4f87bd645c
commit 88a118d81b
4 changed files with 18 additions and 302 deletions
+10
View File
@@ -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');