Permalink
Browse files

#7794 Fix Redis DSN configuration.

  • Loading branch information...
fquffio committed Dec 6, 2015
1 parent dafe49e commit e4cbf57a8455bf6d203b470f2004a094e7f188b2
Showing with 36 additions and 0 deletions.
  1. +4 −0 src/Cache/Engine/RedisEngine.php
  2. +32 −0 tests/TestCase/Cache/Engine/RedisEngineTest.php
@@ -82,6 +82,10 @@ public function init(array $config = [])
return false;
}
if (!empty($config['host'])) {
$this->config('server', $config['host']);
}
parent::init($config);
return $this->_connect();
}
@@ -103,6 +103,38 @@ public function testConfig()
$this->assertEquals($expecting, $config);
}
/**
* testConfigDsn method
*
* @return void
*/
public function testConfigDsn()
{
Cache::config('redis_dsn', [
'url' => 'redis://localhost:6379?database=1&prefix=redis_'
]);
$config = Cache::engine('redis_dsn')->config();
$expecting = [
'prefix' => 'redis_',
'duration' => 3600,
'probability' => 100,
'groups' => [],
'server' => 'localhost',
'port' => 6379,
'timeout' => 0,
'persistent' => true,
'password' => false,
'database' => '1',
'unix_socket' => false,
'host' => 'localhost',
'scheme' => 'redis',
];
$this->assertEquals($expecting, $config);
Cache::drop('redis_dsn');
}
/**
* testConnect method
*

0 comments on commit e4cbf57

Please sign in to comment.