Skip to content

Commit

Permalink
test: Add the testcase for the case.
Browse files Browse the repository at this point in the history
  • Loading branch information
ping-yee committed Sep 1, 2023
1 parent d388388 commit 2b33a11
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/system/Session/Handlers/Database/RedisHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,26 @@ public function testGC(): void
$handler = $this->getInstance();
$this->assertSame(1, $handler->gc(3600));
}

/**
* See https://github.com/codeigniter4/CodeIgniter4/issues/7695
*/
public function testSecondaryReadAfterClose(): void
{
$handler = $this->getInstance();
$handler->open($this->sessionSavePath, $this->sessionName);

$expected = <<<'DATA'
__ci_last_regenerate|i:1664607454;_ci_previous_url|s:32:"http://localhost:8080/index.php/";key|s:5:"value";
DATA;
$this->assertSame($expected, $handler->read('555556b43phsnnf8if6bo33b635e4447'));

$handler->close();

$handler->open($this->sessionSavePath, $this->sessionName);

$this->assertSame($expected, $handler->read('555556b43phsnnf8if6bo33b635e4447'));

$handler->close();
}
}

0 comments on commit 2b33a11

Please sign in to comment.