Skip to content

Commit f9b1a2a

Browse files
authored
Add new test for session store when call remember method with key which already sets (#41685)
1 parent 92f9006 commit f9b1a2a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/Session/SessionStoreTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,17 @@ public function testRememberMethodCallsPutAndReturnsDefault()
482482
$this->assertSame('bar', $result);
483483
}
484484

485+
public function testRememberMethodReturnsPreviousValueIfItAlreadySets()
486+
{
487+
$session = $this->getSession();
488+
$session->put('key', 'foo');
489+
$result = $session->remember('key', function () {
490+
return 'bar';
491+
});
492+
$this->assertSame('foo', $session->get('key'));
493+
$this->assertSame('foo', $result);
494+
}
495+
485496
public function getSession()
486497
{
487498
$reflection = new ReflectionClass(Store::class);

0 commit comments

Comments
 (0)