Skip to content

Commit 2b33a11

Browse files
committed
test: Add the testcase for the case.
1 parent d388388 commit 2b33a11

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/system/Session/Handlers/Database/RedisHandlerTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,26 @@ public function testGC(): void
168168
$handler = $this->getInstance();
169169
$this->assertSame(1, $handler->gc(3600));
170170
}
171+
172+
/**
173+
* See https://github.com/codeigniter4/CodeIgniter4/issues/7695
174+
*/
175+
public function testSecondaryReadAfterClose(): void
176+
{
177+
$handler = $this->getInstance();
178+
$handler->open($this->sessionSavePath, $this->sessionName);
179+
180+
$expected = <<<'DATA'
181+
__ci_last_regenerate|i:1664607454;_ci_previous_url|s:32:"http://localhost:8080/index.php/";key|s:5:"value";
182+
DATA;
183+
$this->assertSame($expected, $handler->read('555556b43phsnnf8if6bo33b635e4447'));
184+
185+
$handler->close();
186+
187+
$handler->open($this->sessionSavePath, $this->sessionName);
188+
189+
$this->assertSame($expected, $handler->read('555556b43phsnnf8if6bo33b635e4447'));
190+
191+
$handler->close();
192+
}
171193
}

0 commit comments

Comments
 (0)