From baad4a271a2753c66b62c0498ffa1ba7fe908669 Mon Sep 17 00:00:00 2001 From: biondizzle Date: Sat, 28 Mar 2026 09:43:34 +0000 Subject: [PATCH] Remove hardcoded Redis URL from tests - Read REDIS_URL from environment - Skip tests if not set --- tests/RedisCacheTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/RedisCacheTest.php b/tests/RedisCacheTest.php index d214fcb..7a56229 100644 --- a/tests/RedisCacheTest.php +++ b/tests/RedisCacheTest.php @@ -17,14 +17,22 @@ use PHPUnit\Framework\TestCase; /** * Tests for Redis-backed caching. + * + * Requires REDIS_URL environment variable. Tests will skip if not set. */ class RedisCacheTest extends TestCase { private CacheInterface $redisCache; - private string $redisUrl = 'REDIS_URL_FROM_ENV'; + private ?string $redisUrl = null; protected function setUp(): void { + $this->redisUrl = getenv('REDIS_URL') ?: null; + + if ($this->redisUrl === null) { + $this->markTestSkipped('REDIS_URL not set, skipping Redis tests'); + } + $this->redisCache = RedisCache::fromUrl($this->redisUrl, 'test_ctx:'); }