mirror of
https://github.com/predis/predis.git
synced 2026-09-10 18:37:34 +00:00
Updated the test suite to work with the new parameters for Predis\Client.
This commit is contained in:
+5
-4
@@ -409,9 +409,12 @@ class CommandPipeline {
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class ConnectionParameters {
|
||||
const DEFAULT_HOST = '127.0.0.1';
|
||||
const DEFAULT_PORT = 6379;
|
||||
private $_parameters;
|
||||
|
||||
public function __construct($parameters) {
|
||||
$parameters = $parameters !== null ? $parameters : array();
|
||||
$this->_parameters = is_array($parameters)
|
||||
? self::filterConnectionParams($parameters)
|
||||
: self::parseURI($parameters);
|
||||
@@ -449,8 +452,8 @@ class ConnectionParameters {
|
||||
|
||||
private static function filterConnectionParams($parameters) {
|
||||
return array(
|
||||
'host' => self::getParamOrDefault($parameters, 'host', Connection::DEFAULT_HOST),
|
||||
'port' => (int) self::getParamOrDefault($parameters, 'port', Connection::DEFAULT_PORT),
|
||||
'host' => self::getParamOrDefault($parameters, 'host', self::DEFAULT_HOST),
|
||||
'port' => (int) self::getParamOrDefault($parameters, 'port', self::DEFAULT_PORT),
|
||||
'database' => self::getParamOrDefault($parameters, 'database'),
|
||||
'password' => self::getParamOrDefault($parameters, 'password')
|
||||
);
|
||||
@@ -470,8 +473,6 @@ interface IConnection {
|
||||
}
|
||||
|
||||
class Connection implements IConnection {
|
||||
const DEFAULT_HOST = '127.0.0.1';
|
||||
const DEFAULT_PORT = 6379;
|
||||
const CONNECTION_TIMEOUT = 2;
|
||||
const READ_WRITE_TIMEOUT = 5;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class RC {
|
||||
private static $_connection;
|
||||
|
||||
private static function createConnection() {
|
||||
$connection = new Predis\Client(RC::SERVER_HOST, RC::SERVER_PORT);
|
||||
$connection = new Predis\Client(array('host' => RC::SERVER_HOST, 'port' => RC::SERVER_PORT));
|
||||
$connection->connect();
|
||||
$connection->selectDatabase(RC::DEFAULT_DATABASE);
|
||||
return $connection;
|
||||
|
||||
Reference in New Issue
Block a user