diff --git a/test/RedisCommandsTest.php b/test/RedisCommandsTest.php index e7d7a5e2..a87de99a 100644 --- a/test/RedisCommandsTest.php +++ b/test/RedisCommandsTest.php @@ -1289,6 +1289,24 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase { }); } + function testZsetReverseRank() { + $zset = RC::zsetAddAndReturn($this->redis, 'zset', RC::getZSetArray()); + + $this->assertEquals(5, $this->redis->zrevrank('zset', 'a')); + $this->assertEquals(4, $this->redis->zrevrank('zset', 'b')); + $this->assertEquals(1, $this->redis->zrevrank('zset', 'e')); + + $this->redis->zrem('zset', 'e'); + $this->assertEquals(1, $this->redis->zrevrank('zset', 'd')); + + $this->assertNull($this->redis->zrevrank('zset', 'x')); + + RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) { + $test->redis->set('foo', 'bar'); + $test->redis->zrevrank('foo', 'a'); + }); + } + /* multiple databases handling commands */ function testSelectDatabase() {