From 3163679f07de94549ceb75d8794df6a2de0bf6a0 Mon Sep 17 00:00:00 2001 From: "A. B. M. Mahmudul Hasan" Date: Fri, 17 Jul 2026 09:44:53 +0600 Subject: [PATCH] updated std --- src/Cluster/Transport/EventField.php | 28 ------------------- .../Pdo/PdoInvalidationTransport.php | 17 ++++++----- .../RedisStreamInvalidationTransport.php | 16 +++++++---- src/Support/RedisConnection.php | 28 +++++++++++++++---- tests/Support/RedisConnectionTest.php | 12 ++++++-- 5 files changed, 52 insertions(+), 49 deletions(-) delete mode 100644 src/Cluster/Transport/EventField.php diff --git a/src/Cluster/Transport/EventField.php b/src/Cluster/Transport/EventField.php deleted file mode 100644 index 86f5942..0000000 --- a/src/Cluster/Transport/EventField.php +++ /dev/null @@ -1,28 +0,0 @@ -connect($host, $port); if (is_string($parts['pass'] ?? null) && $parts['pass'] !== '') { $connection->auth($parts['pass']); } - if (is_string($parts['path'] ?? null) && $parts['path'] !== '/') { - $connection->select((int) ltrim($parts['path'], '/')); + if ($database !== null) { + $connection->select((int) $database); } return $connection; diff --git a/tests/Support/RedisConnectionTest.php b/tests/Support/RedisConnectionTest.php index abc3368..699b173 100644 --- a/tests/Support/RedisConnectionTest.php +++ b/tests/Support/RedisConnectionTest.php @@ -4,7 +4,13 @@ use Infocyph\CacheLayer\Support\RedisConnection; -test('redis connection rejects malformed DSNs before creating a client', function () { - expect(fn () => RedisConnection::connect('redis://')) +test('redis connection rejects malformed DSNs before creating a client', function (string $dsn) { + expect(fn () => RedisConnection::connect($dsn)) ->toThrow(\InvalidArgumentException::class, 'Invalid Redis-compatible DSN.'); -}); +})->with([ + 'missing host' => 'redis://', + 'missing scheme' => '127.0.0.1:6379', + 'unsupported scheme' => 'http://127.0.0.1:6379', + 'invalid database' => 'redis://127.0.0.1/database', + 'invalid port' => 'redis://127.0.0.1:0', +]);