Skip to content

Commit 5432a1a

Browse files
committed
WIP
1 parent 1312548 commit 5432a1a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

packages/http/src/Session/Managers/RedisSessionManager.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ public function cleanup(): void
139139
do {
140140
$result = $this->redis->command('SCAN', $cursor, 'MATCH', $this->getKey(new SessionId('*')), 'COUNT', '100');
141141
$cursor = $result[0];
142-
ld($result);
143142
foreach ($result[1] as $key) {
144143
$sessionId = $this->getSessionIdFromKey($key);
145144

tests/Integration/Http/RedisSessionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use PHPUnit\Framework\Attributes\Test;
88
use Tempest\Clock\Clock;
9+
use Tempest\DateTime\DateTimeInterface;
910
use Tempest\DateTime\Duration;
1011
use Tempest\EventBus\EventBus;
1112
use Tempest\Http\Session\Config\RedisSessionConfig;
@@ -28,7 +29,7 @@ protected function setUp(): void
2829
{
2930
parent::setUp();
3031

31-
$this->container->config(new RedisSessionConfig(expiration: Duration::hours(2)));
32+
$this->container->config(new RedisSessionConfig(expiration: Duration::hours(2), prefix: 'test_session:'));
3233
$this->container->singleton(
3334
SessionManager::class,
3435
fn () => new RedisSessionManager(
@@ -252,7 +253,7 @@ private function assertSessionNotExistsInDatabase(SessionId $sessionId): void
252253
$this->assertNull($session, "Session {$sessionId} should not exist in database");
253254
}
254255

255-
private function getSessionLastActiveTimestamp(SessionId $sessionId): \Tempest\DateTime\DateTime
256+
private function getSessionLastActiveTimestamp(SessionId $sessionId): DateTimeInterface
256257
{
257258
$session = $this->getSessionFromDatabase($sessionId);
258259

@@ -263,11 +264,10 @@ private function getSessionLastActiveTimestamp(SessionId $sessionId): \Tempest\D
263264

264265
private function getSessionFromDatabase(SessionId $id): ?Session
265266
{
266-
$config = $this->container->get(SessionConfig::class);
267267
$redis = $this->container->get(Redis::class);
268268

269269
try {
270-
$content = $redis->get(sprintf('%s%s', $config->prefix, $id));
270+
$content = $redis->get(sprintf('%s%s', 'test_session:', $id));
271271
return unserialize($content, ['allowed_classes' => true]);
272272
} catch (Throwable) {
273273
return null;

0 commit comments

Comments
 (0)