Skip to content

Commit 117c833

Browse files
alebedev80nicolas-grekas
authored andcommitted
[Cache] Fix connecting to Redis via a socket file
1 parent 27782a7 commit 117c833

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function setUp(): void
4545
self::markTestSkipped('Extension redis required.');
4646
}
4747
try {
48-
(new \Redis())->connect(getenv('REDIS_HOST'));
48+
(new \Redis())->connect(...explode(':', getenv('REDIS_HOST')));
4949
} catch (\Exception $e) {
5050
self::markTestSkipped($e->getMessage());
5151
}

Tests/Session/Storage/Handler/PredisClusterSessionHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ class PredisClusterSessionHandlerTest extends AbstractRedisSessionHandlerTestCas
2020
{
2121
protected function createRedisClient(string $host): Client
2222
{
23-
return new Client([['host' => $host]]);
23+
return new Client([array_combine(['host', 'port'], explode(':', getenv('REDIS_HOST')) + [1 => 6379])]);
2424
}
2525
}

Tests/Session/Storage/Handler/PredisSessionHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ class PredisSessionHandlerTest extends AbstractRedisSessionHandlerTestCase
2020
{
2121
protected function createRedisClient(string $host): Client
2222
{
23-
return new Client(['host' => $host]);
23+
return new Client(array_combine(['host', 'port'], explode(':', getenv('REDIS_HOST')) + [1 => 6379]));
2424
}
2525
}

Tests/Session/Storage/Handler/RedisSessionHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class RedisSessionHandlerTest extends AbstractRedisSessionHandlerTestCase
2222
protected function createRedisClient(string $host)
2323
{
2424
$client = new \Redis();
25-
$client->connect($host);
25+
$client->connect(...explode(':', $host));
2626

2727
return $client;
2828
}

0 commit comments

Comments
 (0)