Skip to content

Commit efba08c

Browse files
jitendra-1217SPie
andauthored
Removed filter on username for redis configuration parameter. (#36762)
Co-authored-by: dschobert <d.schobert@ixolit.com>
1 parent 5be0afe commit efba08c

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/Illuminate/Redis/RedisManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ protected function parseConnectionConfiguration($config)
192192
}
193193

194194
return array_filter($parsed, function ($key) {
195-
return ! in_array($key, ['driver', 'username'], true);
195+
return ! in_array($key, ['driver'], true);
196196
}, ARRAY_FILTER_USE_KEY);
197197
}
198198

tests/Redis/RedisConnectorTest.php

+23
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,27 @@ public function testScheme()
160160
$this->assertEquals("tcp://{$host}", $phpRedisClient->getHost());
161161
$this->assertEquals($port, $phpRedisClient->getPort());
162162
}
163+
164+
public function testPredisConfigurationWithUsername()
165+
{
166+
$host = env('REDIS_HOST', '127.0.0.1');
167+
$port = env('REDIS_PORT', 6379);
168+
$username = 'testuser';
169+
$password = 'testpw';
170+
171+
$predis = new RedisManager(new Application, 'predis', [
172+
'default' => [
173+
'host' => $host,
174+
'port' => $port,
175+
'username' => $username,
176+
'password' => $password,
177+
'database' => 5,
178+
'timeout' => 0.5,
179+
],
180+
]);
181+
$predisClient = $predis->connection()->client();
182+
$parameters = $predisClient->getConnection()->getParameters();
183+
$this->assertEquals($username, $parameters->username);
184+
$this->assertEquals($password, $parameters->password);
185+
}
163186
}

0 commit comments

Comments
 (0)