8000 Map `redis` and `rediss` schemes to `tcp` and `tls` · laravel/framework@02667d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 02667d5

Browse files
committed
Map redis and rediss schemes to tcp and tls
1 parent 0a52abf commit 02667d5

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

tests/Redis/RedisConnectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function testUrl()
7777
],
7878
]);
7979
$phpRedisClient = $phpRedis->connection()->client();
80-
$this->assertEquals($host, $phpRedisClient->getHost());
80+
$this->assertEquals("tcp://{$host}", $phpRedisClient->getHost());
8181
$this->assertEquals($port, $phpRedisClient->getPort());
8282
}
8383

tests/Support/ConfigurationUrlParserTest.php

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public function testDriversAliases()
2323
'postgres' => 'pgsql',
2424
'postgresql' => 'pgsql',
2525
'sqlite3' => 'sqlite',
26+
'redis' => 'tcp',
27+
'rediss' => 'tls',
2628
], ConfigurationUrlParser::getDriverAliases());
2729

2830
ConfigurationUrlParser::addDriverAlias('some-particular-alias', 'mysql');
@@ -33,6 +35,8 @@ public function testDriversAliases()
3335
'postgres' => 'pgsql',
3436
'postgresql' => 'pgsql',
3537
'sqlite3' => 'sqlite',
38+
'redis' => 'tcp',
39+
'rediss' => 'tls',
3640
'some-particular-alias' => 'mysql',
3741
], ConfigurationUrlParser::getDriverAliases());
3842

@@ -355,7 +359,7 @@ public function databaseUrls()
355359
'database' => 0,
356360
],
357361
[
358-
'driver' => 'redis',
362+
'driver' => 'tcp',
359363
'host' => 'ec2-111-1-1-1.compute-1.amazonaws.com',
360364
'port' => 111,
361365
'database' => 0,
@@ -367,20 +371,20 @@ public function databaseUrls()
367371
[
368372
'url' => 'redis://h:asdfqwer1234asdf@ec2-111-1-1-1.compute-1.amazonaws.com:111/',
369373
'host' => '127.0.0.1',
370-
'password' => null,
371-
'port' => 6379,
374+
'password' => null,
375+
'port' => 6379,
372376
'database' => 2,
373377
],
374378
[
375-
'driver' => 'redis',
379+
'driver' => 'tcp',
376380
'host' => 'ec2-111-1-1-1.compute-1.amazonaws.com',
377381
'port' => 111,
378382
'database' => 2,
379383
'username' => 'h',
380384
'password' => 'asdfqwer1234asdf',
381385
],
382386
],
383-
'Redis Example with scheme' => [
387+
'Redis Example with tls scheme' => [
384388
[
385389
'url' => 'tls://h:asdfqwer1234asdf@ec2-111-1-1-1.compute-1.amazonaws.com:111',
386390
'host' => '127.0.0.1',
@@ -397,6 +401,23 @@ public function databaseUrls()
397401
'password' => 'asdfqwer1234asdf',
398402
],
399403
],
404+
'Redis Example with rediss scheme' => [
405+
[
406+
'url' => 'rediss://h:asdfqwer1234asdf@ec2-111-1-1-1.compute-1.amazonaws.com:111',
407+
'host' => '127.0.0.1',
408+
'password' => null,
409+
'port' => 6379,
410+
'database' => 0,
411+
],
412+
[
413+
'driver' => 'tls',
414+
'host' => 'ec2-111-1-1-1.compute-1.amazonaws.com',
415+
'port' => 111,
416+
'database' => 0,
417+
'username' => 'h',
418+
'password' => 'asdfqwer1234asdf',
419+
],
420+
],
400421
];
401422
}
402423
}

0 commit comments

Comments
 (0)
0