From e73d9cba8e2ce5fb1370d0137d81246b9c2de897 Mon Sep 17 00:00:00 2001 From: Stanimir Genov Date: Wed, 17 Mar 2021 13:40:56 +0200 Subject: [PATCH 1/2] Allow more parameters to be sent to Predis Client I had a case where I needed to provide a password to connect to Redis and the current code did not allow it. Since everything from the Suite configuration goes to the this->config array, we can simply provide it and allow the user to set the password property This will also allow for other specific configurations --- src/Codeception/Module/Redis.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Codeception/Module/Redis.php b/src/Codeception/Module/Redis.php index fd4157b..a5217f6 100644 --- a/src/Codeception/Module/Redis.php +++ b/src/Codeception/Module/Redis.php @@ -83,11 +83,7 @@ public function _requires() public function _initialize() { try { - $this->driver = new RedisDriver([ - 'host' => $this->config['host'], - 'port' => $this->config['port'], - 'database' => $this->config['database'] - ]); + $this->driver = new RedisDriver($this->config); } catch (\Exception $e) { throw new ModuleException( __CLASS__, From fb5545558e8e82d0680f3f3f89d9536d07f4b75e Mon Sep 17 00:00:00 2001 From: Stanimir Genov Date: Wed, 31 Mar 2021 15:51:11 +0300 Subject: [PATCH 2/2] Add description for Predis functionality I added the full config to Predis' client, so the developer can pass username/password and/or other options. This commit adds some description above. --- src/Codeception/Module/Redis.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Codeception/Module/Redis.php b/src/Codeception/Module/Redis.php index a5217f6..5d5aeca 100644 --- a/src/Codeception/Module/Redis.php +++ b/src/Codeception/Module/Redis.php @@ -21,11 +21,15 @@ * * **`host`** (`string`, default `'127.0.0.1'`) - The Redis host * * **`port`** (`int`, default `6379`) - The Redis port * * **`database`** (`int`, no default) - The Redis database. Needs to be specified. + * * **`username`** (`string`, no default) - When ACLs are enabled on Redis >= 6.0, both username and password are required for user authentication. + * * **`password`** (`string`, no default) - The Redis password/secret. * * **`cleanupBefore`**: (`string`, default `'never'`) - Whether/when to flush the database: * * `suite`: at the beginning of every suite * * `test`: at the beginning of every test * * Any other value: never * + * Note: The full configuration list can be found on Predis' github. + * * ### Example (`unit.suite.yml`) * * ```yaml