Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2019-06-03 03:44:26 +0300
committerGitHub <noreply@github.com>2019-06-03 03:44:26 +0300
commit19f3efcfe6e1a32451a543fa186a8f38d250d941 (patch)
treea05366b25768d5ec2056b43130d2c9181dd77abe /tests
parent07b1e7738e462f5bf8a34061156a93c0d00400ce (diff)
Issue.1555 zrange withscores arg (#1565)
Allows ZRANGE to be called either with `true` or `['withscores' => true]` so it's consistent with `ZRANGEBYSCORE` but also backward compatible. Fixes #1555
Diffstat (limited to 'tests')
-rw-r--r--tests/RedisTest.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/RedisTest.php b/tests/RedisTest.php
index 903a97bf..328a3e12 100644
--- a/tests/RedisTest.php
+++ b/tests/RedisTest.php
@@ -2350,6 +2350,19 @@ class Redis_Test extends TestSuite
$this->assertTrue(0 === $this->redis->zRevRank('z', 'five'));
}
+ public function testZRangeScoreArg() {
+ $this->redis->del('{z}');
+
+ $arr_mems = ['one' => 1.0, 'two' => 2.0, 'three' => 3.0];
+ foreach ($arr_mems as $str_mem => $score) {
+ $this->redis->zAdd('{z}', $score, $str_mem);
+ }
+
+ /* Verify we can pass true and ['withscores' => true] */
+ $this->assertEquals($arr_mems, $this->redis->zRange('{z}', 0, -1, true));
+ $this->assertEquals($arr_mems, $this->redis->zRange('{z}', 0, -1, ['withscores' => true]));
+ }
+
public function testZRangeByLex() {
/* ZRANGEBYLEX available on versions >= 2.8.9 */
if(version_compare($this->version, "2.8.9", "lt")) {