Skip to content

Commit

Permalink
Removed filter on username for redis configuration parameter. (#36762)
Browse files Browse the repository at this point in the history
Co-authored-by: dschobert <d.schobert@ixolit.com>
  • Loading branch information
jitendra-1217 and SPie authored Mar 26, 2021
1 parent 5be0afe commit efba08c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Redis/RedisManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ protected function parseConnectionConfiguration($config)
}

return array_filter($parsed, function ($key) {
return ! in_array($key, ['driver', 'username'], true);
return ! in_array($key, ['driver'], true);
}, ARRAY_FILTER_USE_KEY);
}

Expand Down
23 changes: 23 additions & 0 deletions tests/Redis/RedisConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,27 @@ public function testScheme()
$this->assertEquals("tcp://{$host}", $phpRedisClient->getHost());
$this->assertEquals($port, $phpRedisClient->getPort());
}

public function testPredisConfigurationWithUsername()
{
$host = env('REDIS_HOST', '127.0.0.1');
$port = env('REDIS_PORT', 6379);
$username = 'testuser';
$password = 'testpw';

$predis = new RedisManager(new Application, 'predis', [
'default' => [
'host' => $host,
'port' => $port,
'username' => $username,
'password' => $password,
'database' => 5,
'timeout' => 0.5,
],
]);
$predisClient = $predis->connection()->client();
$parameters = $predisClient->getConnection()->getParameters();
$this->assertEquals($username, $parameters->username);
$this->assertEquals($password, $parameters->password);
}
}

0 comments on commit efba08c

Please sign in to comment.