[Server] Stop Session::forget() from creating missing segments (#484)

This commit is contained in:
Christopher Hertel 2026-09-04 23:55:48 +02:00 • committed by GitHub
commit 4630d7424e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -245,6 +245,21 @@ class SessionTest extends TestCase
$this->assertFalse($this->session->has('nonexistent'));
}
public function testForgetDoesNotCreateIntermediateSegments(): void
{
$this->session->forget('a.b');
$this->assertSame([], $this->session->all());
}
public function testForgetDoesNotOverwriteNonArrayIntermediateValue(): void
{
$this->session->set('key', 'string_value');
$this->session->forget('key.nested');
$this->assertSame('string_value', $this->session->get('key'));
}
public function testSessionCanStoreVariousDataTypes(): void
{
$this->session->set('string', 'value');