From 88fa032c33b6cde959fceae5e7253425a74bb72a Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 1 Aug 2014 12:17:16 +0200 Subject: [PATCH 01/26] Remove extras from composer.json. [ci skip] --- composer.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/composer.json b/composer.json index 711308ea..5742c4c6 100644 --- a/composer.json +++ b/composer.json @@ -27,10 +27,5 @@ }, "autoload": { "psr-4": {"Predis\\": "src/"} - }, - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } } } From 80a5bfa4c120db4ae1277285a587a7eecbfcc4c7 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Fri, 1 Aug 2014 13:49:39 +0100 Subject: [PATCH 02/26] Added a 1.1 branch alias --- composer.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composer.json b/composer.json index 5742c4c6..273e3dd9 100644 --- a/composer.json +++ b/composer.json @@ -27,5 +27,10 @@ }, "autoload": { "psr-4": {"Predis\\": "src/"} + }, + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } } } From 65c2f4bc4fb7609ee73d69aa88313be11ea275ef Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 8 Aug 2014 13:57:05 +0200 Subject: [PATCH 03/26] Back to development. [ci skip] --- VERSION | 2 +- package.ini | 4 ++-- src/Client.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 3eefcb9d..336c3677 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0 +1.1.0-dev diff --git a/package.ini b/package.ini index 459ca0d5..c6963033 100644 --- a/package.ini +++ b/package.ini @@ -10,8 +10,8 @@ name = "Predis" desc = "Flexible and feature-complete PHP client library for Redis" homepage = "http://github.com/nrk/predis" license = "MIT" -version = "1.0.0" -stability = "stable" +version = "1.1.0" +stability = "devel" channel = "pear.nrk.io" author = "Daniele Alessandri \"nrk\" " diff --git a/src/Client.php b/src/Client.php index 94f9c7c9..8cb3b9e1 100644 --- a/src/Client.php +++ b/src/Client.php @@ -42,7 +42,7 @@ use Predis\Transaction\MultiExec as MultiExecTransaction; */ class Client implements ClientInterface { - const VERSION = '1.0.0'; + const VERSION = '1.1.0-dev'; protected $connection; protected $options; From 72ebf5d064517710bba629eaeb388dbb85a77464 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 8 Aug 2014 13:57:35 +0200 Subject: [PATCH 04/26] Add more badges to README. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 14057501..fb5b63e3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ [![Latest Stable Version](https://poser.pugx.org/predis/predis/v/stable.png)](https://packagist.org/packages/predis/predis) [![Total Downloads](https://poser.pugx.org/predis/predis/downloads.png)](https://packagist.org/packages/predis/predis) +[![License](https://poser.pugx.org/predis/predis/license.svg)](https://packagist.org/packages/predis/predis) +[![Build Status](https://travis-ci.org/nrk/predis.svg?branch=master)](https://travis-ci.org/nrk/predis) +[![HHVM Status](http://hhvm.h4cc.de/badge/predis/predis.png)](http://hhvm.h4cc.de/package/predis/predis) Predis is a flexible and feature-complete [Redis](http://redis.io) client library for PHP >= 5.3. From 6b088e4bdae2e436b0a8f77042edc164f376bffd Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Fri, 8 Aug 2014 13:12:33 +0100 Subject: [PATCH 05/26] Removed hhvm from allow failures --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 42b085ed..ef6554f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,3 @@ before_script: - composer install --no-interaction --prefer-source --dev script: - vendor/bin/phpunit -c phpunit.xml.travisci -matrix: - allow_failures: - - php: hhvm - fast_finish: true From cc748d509fee933fda7a4e32fd2a841169b6f968 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 8 Aug 2014 15:29:32 +0200 Subject: [PATCH 06/26] Bump minimum required version of PHP to 5.3.9. This change is needed to address a bug in older versions of PHP 5.3 affecting inheritance (see https://bugs.php.net/bug.php?id=66818). We will most likely resort to a workaround in v1.0 to stick with the currently required minimum version of PHP (>= 5.3.2), but v1.1 will surely require => 5.3.9. [ci skip] --- composer.json | 2 +- package.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 273e3dd9..78ce1bb0 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.2" + "php": ">=5.3.9" }, "require-dev": { "phpunit/phpunit": "~4.0" diff --git a/package.ini b/package.ini index c6963033..275a62c4 100644 --- a/package.ini +++ b/package.ini @@ -17,7 +17,7 @@ channel = "pear.nrk.io" author = "Daniele Alessandri \"nrk\" " [require] -php = ">= 5.3.2" +php = ">= 5.3.9" pearinstaller = "1.4.1" [roles] From 0533b50c6b7235b57661f9e97730f06a1bd0f27e Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 5 Sep 2014 10:49:17 +0200 Subject: [PATCH 07/26] Add hhvm-nightly as a testing environment on Travis CI. --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index ef6554f3..3308f557 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ php: - 5.5 - 5.6 - hhvm + - hhvm-nightly branches: except: - v0.5 @@ -17,3 +18,7 @@ before_script: - composer install --no-interaction --prefer-source --dev script: - vendor/bin/phpunit -c phpunit.xml.travisci +-matrix: +- allow_failures: +- - php: hhvm-nightly +- fast_finish: true From a123ae9159bdc501ca5db98f279d5c591f71ca88 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 10 Oct 2014 17:20:11 +0100 Subject: [PATCH 08/26] Add example for client config --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fb5b63e3..9151ffc9 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,16 @@ it is recommended to refer to their specific documentation or implementation for ### Client configuration ### Various aspects of the client can be configured simply by passing options to the second argument of -`Predis\Client::__construct()`. Options are managed using a mini DI-alike container and their values +`Predis\Client::__construct()`. + +```php +$client = new \Predis\Client( + ['database' => 2], + ['profile' => '2.8', 'prefix' => 'sample:'] +); +``` + +Options are managed using a mini DI-alike container and their values are usually lazily initialized only when needed. Predis by default supports the following options: - `profile`: which profile to use in order to match a specific version of Redis. From cc51db900937749b22278c0500a8b545b3037704 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Tue, 21 Oct 2014 10:53:52 +0200 Subject: [PATCH 09/26] Connection parameters are not the focus of the client options example. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9151ffc9..08e5b97e 100644 --- a/README.md +++ b/README.md @@ -113,11 +113,11 @@ it is recommended to refer to their specific documentation or implementation for ### Client configuration ### Various aspects of the client can be configured simply by passing options to the second argument of -`Predis\Client::__construct()`. +`Predis\Client::__construct()`: ```php $client = new \Predis\Client( - ['database' => 2], + $connection_parameters, ['profile' => '2.8', 'prefix' => 'sample:'] ); ``` From ed1e541dc6d92974a9eb686a60a5cf18c4faca77 Mon Sep 17 00:00:00 2001 From: Vitaly Chirkov Date: Sun, 19 Oct 2014 00:39:57 +0400 Subject: [PATCH 10/26] Add missing doc for zincrby in ClientInterface --- src/ClientInterface.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ClientInterface.php b/src/ClientInterface.php index 42a2856b..f216c470 100644 --- a/src/ClientInterface.php +++ b/src/ClientInterface.php @@ -114,6 +114,7 @@ use Predis\Profile\ProfileInterface; * @method int zadd($key, array $membersAndScoresDictionary) * @method int zcard($key) * @method string zcount($key, $min, $max) + * @method string zincrby($key, $increment, $member) * @method int zinterstore($destination, array $keys, array $options = null) * @method array zrange($key, $start, $stop, array $options = null) * @method array zrangebyscore($key, $min, $max, array $options = null) From 54c8a1ee9b5cfecb10006ba8e552f39e7b8ef754 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Tue, 21 Oct 2014 11:16:55 +0200 Subject: [PATCH 11/26] [tests] Relax checks on invalid expire time messages. Previously there was a bug in Redis that returned the wrong command in -ERR messages when passing an invalid expire time with SETEX and PSETEX. Now that the bug has been fixed and that travis-ci uses a an updated version of Redis, our test suite turned red. --- tests/Predis/Command/StringPreciseSetExpireTest.php | 6 ++---- tests/Predis/Command/StringSetExpireTest.php | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/Predis/Command/StringPreciseSetExpireTest.php b/tests/Predis/Command/StringPreciseSetExpireTest.php index 77df02cb..c93744e6 100644 --- a/tests/Predis/Command/StringPreciseSetExpireTest.php +++ b/tests/Predis/Command/StringPreciseSetExpireTest.php @@ -93,8 +93,7 @@ class StringPreciseSetExpireTest extends PredisCommandTestCase /** * @group connected * @expectedException \Predis\Response\ServerException - * @expectedExceptionMessage ERR invalid expire time in SETEX - * @todo Should not Redis return PSETEX instead of SETEX here? + * @expectedExceptionMessage ERR invalid expire time */ public function testThrowsExceptionOnZeroTTL() { @@ -104,8 +103,7 @@ class StringPreciseSetExpireTest extends PredisCommandTestCase /** * @group connected * @expectedException \Predis\Response\ServerException - * @expectedExceptionMessage ERR invalid expire time in SETEX - * @todo Should not Redis return PSETEX instead of SETEX here? + * @expectedExceptionMessage ERR invalid expire time */ public function testThrowsExceptionOnNegativeTTL() { diff --git a/tests/Predis/Command/StringSetExpireTest.php b/tests/Predis/Command/StringSetExpireTest.php index 59ff77bf..b52e9fab 100644 --- a/tests/Predis/Command/StringSetExpireTest.php +++ b/tests/Predis/Command/StringSetExpireTest.php @@ -94,7 +94,7 @@ class StringSetExpireTest extends PredisCommandTestCase /** * @group connected * @expectedException \Predis\Response\ServerException - * @expectedExceptionMessage ERR invalid expire time in SETEX + * @expectedExceptionMessage ERR invalid expire time */ public function testThrowsExceptionOnZeroTTL() { @@ -104,7 +104,7 @@ class StringSetExpireTest extends PredisCommandTestCase /** * @group connected * @expectedException \Predis\Response\ServerException - * @expectedExceptionMessage ERR invalid expire time in SETEX + * @expectedExceptionMessage ERR invalid expire time */ public function testThrowsExceptionOnNegativeTTL() { From 24e19a9b766fd1e414459060a2bf5268d5f62cf3 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Tue, 21 Oct 2014 11:43:53 +0200 Subject: [PATCH 12/26] Fix bug in ZSCAN-based iterator when sorted sets have integer members. When iterating a sorted set containing integer members, our iterator abstraction based on ZSCAN was always returning "0" as a member value after the first $member => $score pair because of a wrong assumption on how the PHP function array_shift() (used internally to advance to the next pair in our buffered response to ZSCAN) works. Fixes #216. --- CHANGELOG.md | 3 ++ src/Collection/Iterator/SortedSetKey.php | 8 +++- .../Collection/Iterator/SortedSetKeyTest.php | 39 +++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdfdc342..09864363 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ v1.0.1 (2014-xx-xx) ================================================================================ +- __FIX__: broken values returned by `Predis\Collection\Iterator\SortedSetKey` + when iterating sorted set containing integer members (ISSUE #216). + - __FIX__: applied a minor workaround for a bug in old versions of PHP < 5.3.9 affecting inheritance. diff --git a/src/Collection/Iterator/SortedSetKey.php b/src/Collection/Iterator/SortedSetKey.php index 7dc7b09e..f887c40c 100644 --- a/src/Collection/Iterator/SortedSetKey.php +++ b/src/Collection/Iterator/SortedSetKey.php @@ -49,7 +49,11 @@ class SortedSetKey extends CursorBasedIterator */ protected function extractNext() { - $this->position = key($this->elements); - $this->current = array_shift($this->elements); + if ($kv = each($this->elements)) { + $this->position = $kv[0]; + $this->current = $kv[1]; + + unset($this->elements[$this->position]); + } } } diff --git a/tests/Predis/Collection/Iterator/SortedSetKeyTest.php b/tests/Predis/Collection/Iterator/SortedSetKeyTest.php index e3fe9afd..b87d8d90 100644 --- a/tests/Predis/Collection/Iterator/SortedSetKeyTest.php +++ b/tests/Predis/Collection/Iterator/SortedSetKeyTest.php @@ -56,6 +56,45 @@ class SortedSetKeyTest extends PredisTestCase $this->assertFalse($iterator->valid()); } + /** + * @link https://github.com/nrk/predis/issues/216 + * @group disconnected + */ + public function testIterationWithIntegerMembers() + { + $client = $this->getMock('Predis\Client', array('getProfile', 'zscan')); + + $client->expects($this->any()) + ->method('getProfile') + ->will($this->returnValue(Profile\Factory::get('2.8'))); + $client->expects($this->once()) + ->method('zscan') + ->with('key:zset', 0, array()) + ->will($this->returnValue(array(0, array( + 0 => 0, 101 => 1, 102 => 2, + )))); + + $iterator = new SortedSetKey($client, 'key:zset'); + + $iterator->rewind(); + $this->assertTrue($iterator->valid()); + $this->assertSame(0, $iterator->current()); + $this->assertSame(0, $iterator->key()); + + $iterator->next(); + $this->assertTrue($iterator->valid()); + $this->assertSame(1, $iterator->current()); + $this->assertSame(101, $iterator->key()); + + $iterator->next(); + $this->assertTrue($iterator->valid()); + $this->assertSame(2, $iterator->current()); + $this->assertSame(102, $iterator->key()); + + $iterator->next(); + $this->assertFalse($iterator->valid()); + } + /** * @group disconnected */ From 5e24d85c8a8da5969db0f26717529bb60b4fa197 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sat, 25 Oct 2014 17:45:00 +0200 Subject: [PATCH 13/26] Fix E_NOTICE emitted on empty response to INFO [section]. Empty responses can be returned when requesting an unsupported section with the INFO command. --- src/Command/ServerInfoV26x.php | 5 +++++ tests/Predis/Command/ServerInfoV26xTest.php | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Command/ServerInfoV26x.php b/src/Command/ServerInfoV26x.php index 22165db2..c5034eaf 100644 --- a/src/Command/ServerInfoV26x.php +++ b/src/Command/ServerInfoV26x.php @@ -22,7 +22,12 @@ class ServerInfoV26x extends ServerInfo */ public function parseResponse($data) { + if ($data === '') { + return array(); + } + $info = array(); + $current = null; $infoLines = preg_split('/\r?\n/', $data); diff --git a/tests/Predis/Command/ServerInfoV26xTest.php b/tests/Predis/Command/ServerInfoV26xTest.php index a9a89b68..8ebffb06 100644 --- a/tests/Predis/Command/ServerInfoV26xTest.php +++ b/tests/Predis/Command/ServerInfoV26xTest.php @@ -291,6 +291,14 @@ BUFFER; $this->assertSame($expected, $this->getCommand()->parseResponse($raw)); } + /** + * @group disconnected + */ + public function testDoesNotEmitPhpNoticeOnEmptyResponse() + { + $this->assertSame(array(), $this->getCommand()->parseResponse('')); + } + /** * @group connected */ From 330fb41bdca4337b6bd86b00b5c99b4f878a3467 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sat, 25 Oct 2014 17:52:39 +0200 Subject: [PATCH 14/26] Update CHANGELOG. [ci skip] --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09864363..913fd8de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ v1.0.1 (2014-xx-xx) - __FIX__: applied a minor workaround for a bug in old versions of PHP < 5.3.9 affecting inheritance. +- __FIX__: prevent E_NOTICE warnings when using INFO [section] returns an empty + response due to an unsupported specific set of information requested to Redis. + v1.0.0 (2014-08-01) ================================================================================ From 6db2ca38c203c245091f0d1d04f709600ed80a42 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sun, 26 Oct 2014 10:23:50 +0100 Subject: [PATCH 15/26] Apply minor fix to .travis.yml. --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3308f557..09452914 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ before_script: - composer install --no-interaction --prefer-source --dev script: - vendor/bin/phpunit -c phpunit.xml.travisci --matrix: -- allow_failures: -- - php: hhvm-nightly -- fast_finish: true +matrix: + allow_failures: + - php: hhvm-nightly + fast_finish: true From 54d467e530a68a2f3f7a4cbbf73552f304eea7b3 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sun, 26 Oct 2014 10:28:33 +0100 Subject: [PATCH 16/26] Add missing doc for zincrby in ClientContextInterface. [ci skip] --- src/ClientContextInterface.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ClientContextInterface.php b/src/ClientContextInterface.php index 63b77d7d..2964e4f3 100644 --- a/src/ClientContextInterface.php +++ b/src/ClientContextInterface.php @@ -106,6 +106,7 @@ use Predis\Command\CommandInterface; * @method $this zadd($key, array $membersAndScoresDictionary) * @method $this zcard($key) * @method $this zcount($key, $min, $max) + * @method $this zincrby($key, $increment, $member) * @method $this zinterstore($destination, array $keys, array $options = null) * @method $this zrange($key, $start, $stop, array $options = null) * @method $this zrangebyscore($key, $min, $max, array $options = null) From 381ca9969634289fd24ed1c70efd2c4f97c8793e Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 7 Nov 2014 14:19:08 +0100 Subject: [PATCH 17/26] [tests] Use round() to avoid issues with floats on certain plaforms. See issue #220 on GitHub for reference. --- tests/Predis/Command/HashIncrementByFloatTest.php | 8 ++++++-- tests/Predis/Command/StringIncrementByFloatTest.php | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/Predis/Command/HashIncrementByFloatTest.php b/tests/Predis/Command/HashIncrementByFloatTest.php index afb1c4b3..3489ed22 100644 --- a/tests/Predis/Command/HashIncrementByFloatTest.php +++ b/tests/Predis/Command/HashIncrementByFloatTest.php @@ -63,8 +63,10 @@ class HashIncrementByFloatTest extends PredisCommandTestCase $redis = $this->getClient(); $this->assertSame('10.5', $redis->hincrbyfloat('metavars', 'foo', 10.5)); - $this->assertSame('10.001', $redis->hincrbyfloat('metavars', 'hoge', 10.001)); + + $redis->hincrbyfloat('metavars', 'hoge', 10.001); $this->assertSame('11', $redis->hincrbyfloat('metavars', 'hoge', 0.999)); + $this->assertSame(array('foo' => '10.5', 'hoge' => '11'), $redis->hgetall('metavars')); } @@ -76,8 +78,10 @@ class HashIncrementByFloatTest extends PredisCommandTestCase $redis = $this->getClient(); $this->assertSame('-10.5', $redis->hincrbyfloat('metavars', 'foo', -10.5)); - $this->assertSame('-10.001', $redis->hincrbyfloat('metavars', 'hoge', -10.001)); + + $redis->hincrbyfloat('metavars', 'hoge', -10.001); $this->assertSame('-11', $redis->hincrbyfloat('metavars', 'hoge', -0.999)); + $this->assertSame(array('foo' => '-10.5', 'hoge' => '-11'), $redis->hgetall('metavars')); } diff --git a/tests/Predis/Command/StringIncrementByFloatTest.php b/tests/Predis/Command/StringIncrementByFloatTest.php index f0bcf82f..8416615d 100644 --- a/tests/Predis/Command/StringIncrementByFloatTest.php +++ b/tests/Predis/Command/StringIncrementByFloatTest.php @@ -75,9 +75,11 @@ class StringIncrementByFloatTest extends PredisCommandTestCase $redis->set('foo', 2); + // We use round() to avoid errors on some platforms, see the following + // issue https://github.com/nrk/predis/issues/220 for reference. $this->assertEquals(22.123, $redis->incrbyfloat('foo', 20.123)); - $this->assertEquals(10, $redis->incrbyfloat('foo', -12.123)); - $this->assertEquals(-100.01, $redis->incrbyfloat('foo', -110.01)); + $this->assertEquals(10, round($redis->incrbyfloat('foo', -12.123), 5)); + $this->assertEquals(-100.01, round($redis->incrbyfloat('foo', -110.01), 5)); } /** From 28accc93f0c3868711cfc89089f8cd953d642851 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 7 Nov 2014 14:24:35 +0100 Subject: [PATCH 18/26] [tests] Test serialization of redis-cluster connection with @medium. Serializing an instance of a redis-cluster connection with its nodes can take more than 1 seconds on extremely slow hardware. See issue #220 for reference. --- tests/Predis/Connection/Aggregate/RedisClusterTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Predis/Connection/Aggregate/RedisClusterTest.php b/tests/Predis/Connection/Aggregate/RedisClusterTest.php index c848bbd9..7446e262 100644 --- a/tests/Predis/Connection/Aggregate/RedisClusterTest.php +++ b/tests/Predis/Connection/Aggregate/RedisClusterTest.php @@ -731,6 +731,7 @@ class RedisClusterTest extends PredisTestCase } /** + * @medium * @group disconnected */ public function testCanBeSerialized() From 1e774f4686985a1c233b6d106087ed6e46cfe248 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 2 Jan 2015 12:02:05 +0100 Subject: [PATCH 19/26] Apply minor CS fixes and trim spurious spaces. --- src/Profile/RedisVersion280.php | 2 +- src/Profile/RedisVersion300.php | 2 +- tests/Predis/Command/StringBitPosTest.php | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Profile/RedisVersion280.php b/src/Profile/RedisVersion280.php index 0bb92940..e970e17e 100644 --- a/src/Profile/RedisVersion280.php +++ b/src/Profile/RedisVersion280.php @@ -234,7 +234,7 @@ class RedisVersion280 extends RedisProfile /* commands operating on the key space */ 'SCAN' => 'Predis\Command\KeyScan', - + /* commands operating on string values */ 'BITPOS' => 'Predis\Command\StringBitPos', diff --git a/src/Profile/RedisVersion300.php b/src/Profile/RedisVersion300.php index b95ba04f..14bb6297 100644 --- a/src/Profile/RedisVersion300.php +++ b/src/Profile/RedisVersion300.php @@ -234,7 +234,7 @@ class RedisVersion300 extends RedisProfile /* commands operating on the key space */ 'SCAN' => 'Predis\Command\KeyScan', - + /* commands operating on string values */ 'BITPOS' => 'Predis\Command\StringBitPos', diff --git a/tests/Predis/Command/StringBitPosTest.php b/tests/Predis/Command/StringBitPosTest.php index bbc669fd..246db7b9 100644 --- a/tests/Predis/Command/StringBitPosTest.php +++ b/tests/Predis/Command/StringBitPosTest.php @@ -8,6 +8,7 @@ * file that was distributed with this source code. */ namespace Predis\Command; + /** * @group commands * @group realm-string @@ -21,6 +22,7 @@ class StringBitPosTest extends PredisCommandTestCase { return 'Predis\Command\StringBitPos'; } + /** * {@inheritdoc} */ @@ -28,6 +30,7 @@ class StringBitPosTest extends PredisCommandTestCase { return 'BITPOS'; } + /** * @group disconnected */ @@ -35,10 +38,13 @@ class StringBitPosTest extends PredisCommandTestCase { $arguments = array('key', 0, 1, 10); $expected = array('key', 0, 1, 10); + $command = $this->getCommand(); $command->setArguments($arguments); + $this->assertSame($expected, $command->getArguments()); } + /** * @group disconnected */ @@ -47,23 +53,29 @@ class StringBitPosTest extends PredisCommandTestCase $raw = 10; $expected = 10; $command = $this->getCommand(); + $this->assertSame($expected, $command->parseResponse($raw)); } + /** * @group connected */ public function testReturnsBitPosition() { $redis = $this->getClient(); + $redis->setbit('key', 10, 0); $this->assertSame(0, $redis->bitpos('key', 0), 'Get position of first bit set to 0 - full range'); $this->assertSame(-1, $redis->bitpos('key', 1), 'Get position of first bit set to 1 - full range'); $this->assertSame(-1, $redis->bitpos('key', 1, 5, 10), 'Get position of first bit set to 1 - specific range'); + $redis->setbit('key', 5, 1); $this->assertSame(0, $redis->bitpos('key', 0), 'Get position of first bit set to 0 - full range'); $this->assertSame(5, $redis->bitpos('key', 1), 'Get position of first bit set to 1 - full range'); - $this->assertSame(-1, $redis->bitpos('key', 1, 5, 10), 'Get position of first bit set to 1 - specific range'); + $this->assertSame(-1, $redis->bitpos('key', 1, 5, 10), 'Get position of first bit set to 1 - specific range'); + } + /** * @group connected * @expectedException \Predis\Response\ServerException From e9264bb087279b6cf04e2757074a070e8150f777 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 2 Jan 2015 12:06:42 +0100 Subject: [PATCH 20/26] Add minimum required Redis version for BITPOS integration tests. --- tests/Predis/Command/StringBitPosTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Predis/Command/StringBitPosTest.php b/tests/Predis/Command/StringBitPosTest.php index 246db7b9..57999e9c 100644 --- a/tests/Predis/Command/StringBitPosTest.php +++ b/tests/Predis/Command/StringBitPosTest.php @@ -59,6 +59,7 @@ class StringBitPosTest extends PredisCommandTestCase /** * @group connected + * @requiresRedisVersion >= 2.8.7 */ public function testReturnsBitPosition() { @@ -78,6 +79,7 @@ class StringBitPosTest extends PredisCommandTestCase /** * @group connected + * @requiresRedisVersion >= 2.8.7 * @expectedException \Predis\Response\ServerException * @expectedExceptionMessage Operation against a key holding the wrong kind of value */ From c1e641e35663d8996a6c75ecdc1143c3c3a83b09 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 2 Jan 2015 12:20:00 +0100 Subject: [PATCH 21/26] No need to access a private field used by PHPUnit. Fixes #207. --- tests/PHPUnit/PredisTestCase.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/PHPUnit/PredisTestCase.php b/tests/PHPUnit/PredisTestCase.php index ddb9c7ba..6240697a 100644 --- a/tests/PHPUnit/PredisTestCase.php +++ b/tests/PHPUnit/PredisTestCase.php @@ -19,6 +19,7 @@ use Predis\Profile; */ abstract class PredisTestCase extends \PHPUnit_Framework_TestCase { + protected $predisRequirements = array(); protected $redisServerVersion = null; /** @@ -263,7 +264,7 @@ abstract class PredisTestCase extends \PHPUnit_Framework_TestCase !empty($annotations['method']['requiresRedisVersion']) && in_array('connected', $annotations['method']['group']) ) { - $this->required['requiresRedisVersion'] = $annotations['method']['requiresRedisVersion'][0]; + $this->predisRequirements['requiresRedisVersion'] = $annotations['method']['requiresRedisVersion'][0]; } } @@ -272,12 +273,12 @@ abstract class PredisTestCase extends \PHPUnit_Framework_TestCase */ protected function checkRequiredRedisVersion() { - if (!isset($this->required['requiresRedisVersion'])) { + if (!isset($this->predisRequirements['requiresRedisVersion'])) { return; } $srvVersion = $this->getRedisServerVersion(); - $expectation = explode(' ', $this->required['requiresRedisVersion'], 2); + $expectation = explode(' ', $this->predisRequirements['requiresRedisVersion'], 2); if (count($expectation) === 1) { $expOperator = '>='; From 08fd312fb57a627e49ab22ed83acc00d7a812c3d Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 2 Jan 2015 12:56:48 +0100 Subject: [PATCH 22/26] Temporarily allow failures for HHVM on Travis-CI. [ci skip] --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 09452914..1bd2b773 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,5 +20,6 @@ script: - vendor/bin/phpunit -c phpunit.xml.travisci matrix: allow_failures: + - php: hhvm - php: hhvm-nightly fast_finish: true From 216795e475654823ac48729bb4dd3f1050c15976 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 2 Jan 2015 13:42:50 +0100 Subject: [PATCH 23/26] Update CHANGELOG. [ci skip] --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 913fd8de..753294b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ -v1.0.1 (2014-xx-xx) +v1.0.1 (2015-01-xx) ================================================================================ +- Added `BITPOS` to the server profile for Redis 2.8. + +- Connection timeout for read/write operations can now be set for UNIX sockets + where the underlying connection uses PHP's stream. + - __FIX__: broken values returned by `Predis\Collection\Iterator\SortedSetKey` when iterating sorted set containing integer members (ISSUE #216). From 32774c925a1cdb6d3cdcd1fdc050f5df603738cd Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 2 Jan 2015 13:44:54 +0100 Subject: [PATCH 24/26] Bump year in LICENSE. [ci skip] --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index dd35c235..74f4f88f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009-2014 Daniele Alessandri +Copyright (c) 2009-2015 Daniele Alessandri Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation From b8decc75a884fce1bfc62d5bc6823298a678f890 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 2 Jan 2015 14:37:26 +0100 Subject: [PATCH 25/26] Update CHANGELOG. [ci skip] --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 753294b1..c68c51d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -v1.0.1 (2015-01-xx) +v1.0.1 (2015-01-02) ================================================================================ - Added `BITPOS` to the server profile for Redis 2.8. From af48b30398066a598a12f033e53c1701078b2d56 Mon Sep 17 00:00:00 2001 From: Michal Humpula Date: Fri, 23 Jan 2015 22:33:12 +0100 Subject: [PATCH 26/26] add zrevrangebylex command --- src/Cluster/ClusterStrategy.php | 1 + src/Command/Processor/KeyPrefixProcessor.php | 1 + src/Command/ZSetReverseRangeByLex.php | 21 ++ src/Profile/RedisVersion280.php | 1 + src/Profile/RedisVersion300.php | 1 + src/Replication/ReplicationStrategy.php | 1 + tests/Predis/Cluster/PredisStrategyTest.php | 1 + tests/Predis/Cluster/RedisStrategyTest.php | 1 + .../Processor/KeyPrefixProcessorTest.php | 4 + .../Command/ZSetReverseRangeByLexTest.php | 192 ++++++++++++++++++ tests/Predis/Profile/RedisUnstableTest.php | 13 +- tests/Predis/Profile/RedisVersion280Test.php | 13 +- tests/Predis/Profile/RedisVersion300Test.php | 13 +- .../Replication/ReplicationStrategyTest.php | 1 + 14 files changed, 246 insertions(+), 18 deletions(-) create mode 100644 src/Command/ZSetReverseRangeByLex.php create mode 100644 tests/Predis/Command/ZSetReverseRangeByLexTest.php diff --git a/src/Cluster/ClusterStrategy.php b/src/Cluster/ClusterStrategy.php index 4d49f43f..fee7d2ff 100644 --- a/src/Cluster/ClusterStrategy.php +++ b/src/Cluster/ClusterStrategy.php @@ -138,6 +138,7 @@ abstract class ClusterStrategy implements StrategyInterface 'ZLEXCOUNT' => $getKeyFromFirstArgument, 'ZRANGEBYLEX' => $getKeyFromFirstArgument, 'ZREMRANGEBYLEX' => $getKeyFromFirstArgument, + 'ZREVRANGEBYLEX' => $getKeyFromFirstArgument, /* commands operating on hashes */ 'HDEL' => $getKeyFromFirstArgument, diff --git a/src/Command/Processor/KeyPrefixProcessor.php b/src/Command/Processor/KeyPrefixProcessor.php index b873ab42..b2d203da 100644 --- a/src/Command/Processor/KeyPrefixProcessor.php +++ b/src/Command/Processor/KeyPrefixProcessor.php @@ -155,6 +155,7 @@ class KeyPrefixProcessor implements ProcessorInterface 'ZLEXCOUNT' => 'self::first', 'ZRANGEBYLEX' => 'self::first', 'ZREMRANGEBYLEX' => 'self::first', + 'ZREVRANGEBYLEX' => 'self::first', ); } diff --git a/src/Command/ZSetReverseRangeByLex.php b/src/Command/ZSetReverseRangeByLex.php new file mode 100644 index 00000000..b9eb2512 --- /dev/null +++ b/src/Command/ZSetReverseRangeByLex.php @@ -0,0 +1,21 @@ + 'Predis\Command\ZSetLexCount', 'ZRANGEBYLEX' => 'Predis\Command\ZSetRangeByLex', 'ZREMRANGEBYLEX' => 'Predis\Command\ZSetRemoveRangeByLex', + 'ZREVRANGEBYLEX' => 'Predis\Command\ZSetReverseRangeByLex', /* commands operating on hashes */ 'HSCAN' => 'Predis\Command\HashScan', diff --git a/src/Profile/RedisVersion300.php b/src/Profile/RedisVersion300.php index 14bb6297..97578955 100644 --- a/src/Profile/RedisVersion300.php +++ b/src/Profile/RedisVersion300.php @@ -246,6 +246,7 @@ class RedisVersion300 extends RedisProfile 'ZLEXCOUNT' => 'Predis\Command\ZSetLexCount', 'ZRANGEBYLEX' => 'Predis\Command\ZSetRangeByLex', 'ZREMRANGEBYLEX' => 'Predis\Command\ZSetRemoveRangeByLex', + 'ZREVRANGEBYLEX' => 'Predis\Command\ZSetReverseRangeByLex', /* commands operating on hashes */ 'HSCAN' => 'Predis\Command\HashScan', diff --git a/src/Replication/ReplicationStrategy.php b/src/Replication/ReplicationStrategy.php index 169cd8c0..87f1d267 100644 --- a/src/Replication/ReplicationStrategy.php +++ b/src/Replication/ReplicationStrategy.php @@ -211,6 +211,7 @@ class ReplicationStrategy 'ZSCAN' => true, 'ZLEXCOUNT' => true, 'ZRANGEBYLEX' => true, + 'ZREVRANGEBYLEX' => true, 'HGET' => true, 'HMGET' => true, 'HEXISTS' => true, diff --git a/tests/Predis/Cluster/PredisStrategyTest.php b/tests/Predis/Cluster/PredisStrategyTest.php index 42d4db70..11c8b3d2 100644 --- a/tests/Predis/Cluster/PredisStrategyTest.php +++ b/tests/Predis/Cluster/PredisStrategyTest.php @@ -349,6 +349,7 @@ class PredisStrategyTest extends PredisTestCase 'ZLEXCOUNT' => 'keys-first', 'ZRANGEBYLEX' => 'keys-first', 'ZREMRANGEBYLEX' => 'keys-first', + 'ZREVRANGEBYLEX' => 'keys-first', /* commands operating on hashes */ 'HDEL' => 'keys-first', diff --git a/tests/Predis/Cluster/RedisStrategyTest.php b/tests/Predis/Cluster/RedisStrategyTest.php index 6a034edd..d15c84e8 100644 --- a/tests/Predis/Cluster/RedisStrategyTest.php +++ b/tests/Predis/Cluster/RedisStrategyTest.php @@ -359,6 +359,7 @@ class RedisStrategyTest extends PredisTestCase 'ZLEXCOUNT' => 'keys-first', 'ZRANGEBYLEX' => 'keys-first', 'ZREMRANGEBYLEX' => 'keys-first', + 'ZREVRANGEBYLEX' => 'keys-first', /* commands operating on hashes */ 'HDEL' => 'keys-first', diff --git a/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php b/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php index 709e6007..58208d64 100644 --- a/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php +++ b/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php @@ -825,6 +825,10 @@ class KeyPrefixProcessorTest extends PredisTestCase array('key', '-', '+'), array('prefix:key', '-', '+'), ), + array('ZREVRANGEBYLEX', + array('key', '+', '-', 'LIMIT', '0', '10'), + array('prefix:key', '+', '-', 'LIMIT', '0', '10'), + ), ); } } diff --git a/tests/Predis/Command/ZSetReverseRangeByLexTest.php b/tests/Predis/Command/ZSetReverseRangeByLexTest.php new file mode 100644 index 00000000..5bbf2ec8 --- /dev/null +++ b/tests/Predis/Command/ZSetReverseRangeByLexTest.php @@ -0,0 +1,192 @@ + array(0, 100), + ); + + $arguments = array('zset', '[a', '[z', $modifiers); + $expected = array('zset', '[a', '[z', 'LIMIT', 0, 100); + + $command = $this->getCommand(); + $command->setArguments($arguments); + + $this->assertSame($expected, $command->getArguments()); + } + + /** + * @group disconnected + */ + public function testFilterArgumentsWithNamedLimit() + { + $arguments = array('zset', '[a', '[z', array('limit' => array('offset' => 1, 'count' => 2))); + $expected = array('zset', '[a', '[z', 'LIMIT', 1, 2); + + $command = $this->getCommand(); + $command->setArguments($arguments); + + $this->assertSame($expected, $command->getArguments()); + } + + /** + * @group disconnected + */ + public function testParseResponse() + { + $raw = array('a', 'b', 'c'); + $expected = array('a', 'b', 'c'); + + $command = $this->getCommand(); + + $this->assertSame($expected, $command->parseResponse($raw)); + } + + /** + * @group connected + * @requiresRedisVersion >= 2.8.9 + */ + public function testReturnsElementsInWholeRange() + { + $redis = $this->getClient(); + + $redis->zadd('letters', 0, 'a', 0, 'b', 0, 'c', 0, 'd', 0, 'e', 0, 'f', 0, 'g'); + + $this->assertSame(array('g', 'f', 'e', 'd', 'c', 'b', 'a'), $redis->zrevrangebylex('letters', '+', '-')); + $this->assertSame(array(), $redis->zrevrangebylex('letters', '-', '+')); + $this->assertSame(array(), $redis->zrevrangebylex('unknown', '-', '+')); + $this->assertSame(array(), $redis->zrevrangebylex('unknown', '+', '-')); + } + + /** + * @group connected + * @requiresRedisVersion >= 2.8.9 + */ + public function testReturnsElementsInInclusiveRange() + { + $redis = $this->getClient(); + + $redis->zadd('letters', 0, 'a', 0, 'b', 0, 'c', 0, 'd', 0, 'e', 0, 'f', 0, 'g'); + + $this->assertSame(array('a'), $redis->zrevrangebylex('letters', '[a', '[a')); + $this->assertSame(array('f', 'e', 'd', 'c'), $redis->zrevrangebylex('letters', '[f', '[c')); + $this->assertSame(array('g', 'f', 'e'), $redis->zrevrangebylex('letters', '+', '[e')); + $this->assertSame(array(), $redis->zrevrangebylex('letters', '-', '[c')); + $this->assertSame(array(), $redis->zrevrangebylex('letters', '[z', '[x')); + $this->assertSame(array(), $redis->zrevrangebylex('unknown', '[1', '[0')); + } + + /** + * @group connected + * @requiresRedisVersion >= 2.8.9 + */ + public function testReturnsElementsInExclusiveRange() + { + $redis = $this->getClient(); + + $redis->zadd('letters', 0, 'a', 0, 'b', 0, 'c', 0, 'd', 0, 'e', 0, 'f', 0, 'g'); + + $this->assertSame(array(), $redis->zrevrangebylex('letters', '(a', '(a')); + $this->assertSame(array('e', 'd'), $redis->zrevrangebylex('letters', '(f', '(c')); + $this->assertSame(array('g', 'f'), $redis->zrevrangebylex('letters', '+', '(e')); + $this->assertSame(array(), $redis->zrevrangebylex('letters', '-', '(c')); + $this->assertSame(array(), $redis->zrevrangebylex('letters', '(z', '(x')); + $this->assertSame(array(), $redis->zrevrangebylex('unknown', '(1', '(0')); + } + + /** + * @group connected + * @requiresRedisVersion >= 2.8.9 + */ + public function testReturnsElementsInMixedRange() + { + $redis = $this->getClient(); + + $redis->zadd('letters', 0, 'a', 0, 'b', 0, 'c', 0, 'd', 0, 'e', 0, 'f', 0, 'g'); + + $this->assertSame(array(), $redis->zrevrangebylex('letters', '[a', '(a')); + $this->assertSame(array(), $redis->zrevrangebylex('letters', '(a', '[a')); + $this->assertSame(array('f', 'e', 'd'), $redis->zrevrangebylex('letters', '[f', '(c')); + $this->assertSame(array('e', 'd', 'c'), $redis->zrevrangebylex('letters', '(f', '[c')); + $this->assertSame(array(), $redis->zrevrangebylex('unknown', '[5', '(0')); + } + + /** + * @group connected + * @requiresRedisVersion >= 2.8.9 + */ + public function testRangeWithLimitModifier() + { + $redis = $this->getClient(); + + $redis->zadd('letters', 0, 'a', 0, 'b', 0, 'c', 0, 'd', 0, 'e', 0, 'f', 0, 'g'); + + $this->assertSame(array('e', 'd', 'c'), $redis->zrevrangebylex('letters', '+', '-', 'LIMIT', '2', '3')); + $this->assertSame(array('e', 'd', 'c'), $redis->zrevrangebylex('letters', '+', '-', array('limit' => array(2, 3)))); + $this->assertSame(array('e', 'd', 'c'), $redis->zrevrangebylex('letters', '+', '-', array('limit' => array('offset' => 2, 'count' => 3)))); + $this->assertSame(array(), $redis->zrevrangebylex('letters', '[f', '[a', 'LIMIT', '2', '0')); + $this->assertSame(array(), $redis->zrevrangebylex('letters', '[f', '[a', 'LIMIT', '-4', '2')); + } + + /** + * @group connected + * @requiresRedisVersion >= 2.8.9 + * @expectedException \Predis\Response\ServerException + * @expectedExceptionMessage min or max not valid string range item + */ + public function testThrowsExceptionOnInvalidRangeFormat() + { + $redis = $this->getClient(); + + $redis->zadd('letters', 0, 'a', 0, 'b', 0, 'c', 0, 'd', 0, 'e', 0, 'f', 0, 'g'); + $redis->zrevrangebylex('letters', 'f', 'b'); + } + + /** + * @group connected + * @requiresRedisVersion >= 2.8.9 + * @expectedException \Predis\Response\ServerException + * @expectedExceptionMessage Operation against a key holding the wrong kind of value + */ + public function testThrowsExceptionOnWrongType() + { + $redis = $this->getClient(); + + $redis->set('foo', 'bar'); + $redis->zrevrangebylex('foo', '+', '-'); + } +} diff --git a/tests/Predis/Profile/RedisUnstableTest.php b/tests/Predis/Profile/RedisUnstableTest.php index 21dde616..adeea30c 100644 --- a/tests/Predis/Profile/RedisUnstableTest.php +++ b/tests/Predis/Profile/RedisUnstableTest.php @@ -181,12 +181,13 @@ class RedisUnstableTest extends PredisProfileTestCase 140 => 'ZLEXCOUNT', 141 => 'ZRANGEBYLEX', 142 => 'ZREMRANGEBYLEX', - 143 => 'HSCAN', - 144 => 'PUBSUB', - 145 => 'PFADD', - 146 => 'PFCOUNT', - 147 => 'PFMERGE', - 148 => 'COMMAND', + 143 => 'ZREVRANGEBYLEX', + 144 => 'HSCAN', + 145 => 'PUBSUB', + 146 => 'PFADD', + 147 => 'PFCOUNT', + 148 => 'PFMERGE', + 149 => 'COMMAND', ); } } diff --git a/tests/Predis/Profile/RedisVersion280Test.php b/tests/Predis/Profile/RedisVersion280Test.php index 11ab7d6e..b72d7433 100644 --- a/tests/Predis/Profile/RedisVersion280Test.php +++ b/tests/Predis/Profile/RedisVersion280Test.php @@ -181,12 +181,13 @@ class RedisVersion280Test extends PredisProfileTestCase 140 => 'ZLEXCOUNT', 141 => 'ZRANGEBYLEX', 142 => 'ZREMRANGEBYLEX', - 143 => 'HSCAN', - 144 => 'PUBSUB', - 145 => 'PFADD', - 146 => 'PFCOUNT', - 147 => 'PFMERGE', - 148 => 'COMMAND', + 143 => 'ZREVRANGEBYLEX', + 144 => 'HSCAN', + 145 => 'PUBSUB', + 146 => 'PFADD', + 147 => 'PFCOUNT', + 148 => 'PFMERGE', + 149 => 'COMMAND', ); } } diff --git a/tests/Predis/Profile/RedisVersion300Test.php b/tests/Predis/Profile/RedisVersion300Test.php index c7fc4b73..088051ab 100644 --- a/tests/Predis/Profile/RedisVersion300Test.php +++ b/tests/Predis/Profile/RedisVersion300Test.php @@ -181,12 +181,13 @@ class RedisVersion300Test extends PredisProfileTestCase 140 => 'ZLEXCOUNT', 141 => 'ZRANGEBYLEX', 142 => 'ZREMRANGEBYLEX', - 143 => 'HSCAN', - 144 => 'PUBSUB', - 145 => 'PFADD', - 146 => 'PFCOUNT', - 147 => 'PFMERGE', - 148 => 'COMMAND', + 143 => 'ZREVRANGEBYLEX', + 144 => 'HSCAN', + 145 => 'PUBSUB', + 146 => 'PFADD', + 147 => 'PFCOUNT', + 148 => 'PFMERGE', + 149 => 'COMMAND', ); } } diff --git a/tests/Predis/Replication/ReplicationStrategyTest.php b/tests/Predis/Replication/ReplicationStrategyTest.php index befa082e..6735b4c0 100644 --- a/tests/Predis/Replication/ReplicationStrategyTest.php +++ b/tests/Predis/Replication/ReplicationStrategyTest.php @@ -346,6 +346,7 @@ class ReplicationStrategyTest extends PredisTestCase 'ZLEXCOUNT' => 'read', 'ZRANGEBYLEX' => 'read', 'ZREMRANGEBYLEX' => 'write', + 'ZREVRANGEBYLEX' => 'read', /* commands operating on hashes */ 'HDEL' => 'write',