Skip to content

Commit 693b45f

Browse files
committed
chore(tests): skip redis tests if there is no redis connection
1 parent 16655b4 commit 693b45f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/Integration/Http/RedisSessionTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,21 @@ protected function setUp(): void
3838
$this->container->get(SessionConfig::class),
3939
),
4040
);
41+
42+
try {
43+
$this->container->get(Redis::class)->connect();
44+
} catch (Throwable) {
45+
$this->markTestSkipped('Could not connect to Redis.');
46+
}
4147
}
4248

4349
protected function tearDown(): void
4450
{
45-
$this->container->get(Redis::class)->flush();
51+
try {
52+
$this->container->get(Redis::class)->flush();
53+
} catch (Throwable) {
54+
// Redis not available, nothing to clean up
55+
}
4656
}
4757

4858
#[Test]

0 commit comments

Comments
 (0)