示例#1
0
 public static function createConnection(array $additional = array())
 {
     $serverProfile = Predis\Profiles\ServerProfile::get(self::SERVER_VERSION);
     $connection = new Predis\Client(RC::getConnectionArguments($additional), $serverProfile);
     $connection->connect();
     $connection->select(RC::DEFAULT_DATABASE);
     return $connection;
 }
示例#2
0
 function testServerProfile_CommandsRegistration()
 {
     $profile = Predis\Profiles\ServerProfile::get('1.2');
     $cmdId = 'multi';
     $cmdClass = '\\Predis\\Commands\\TransactionMulti';
     $this->assertFalse($profile->supportsCommand($cmdId));
     $profile->defineCommand($cmdId, new $cmdClass());
     $this->assertTrue($profile->supportsCommand($cmdId));
     $this->assertInstanceOf($cmdClass, $profile->createCommand($cmdId));
 }