mirror of
https://github.com/predis/predis.git
synced 2026-09-13 20:07:28 +00:00
Extended the tests for ZRANGE and ZREVRANGE to cover the newly added "WITHSCORES" option.
This commit is contained in:
@@ -941,6 +941,16 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
|
||||
$this->redis->zsetRange('zset', -100, 100)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
array_values(array_keys($zset)),
|
||||
$this->redis->zsetRange('zset', -100, 100)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
array(array('a', -10), array('b', 0), array('c', 10)),
|
||||
$this->redis->zsetRange('zset', 0, 2, 'withscores')
|
||||
);
|
||||
|
||||
RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) {
|
||||
$test->redis->set('foo', 'bar');
|
||||
$test->redis->zsetRange('foo', 0, -1);
|
||||
@@ -990,6 +1000,11 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
|
||||
$this->redis->zsetReverseRange('zset', -100, 100)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
array(array('f', 30), array('e', 20), array('d', 20)),
|
||||
$this->redis->zsetReverseRange('zset', 0, 2, 'withscores')
|
||||
);
|
||||
|
||||
RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) {
|
||||
$test->redis->set('foo', 'bar');
|
||||
$test->redis->zsetReverseRange('foo', 0, -1);
|
||||
|
||||
Reference in New Issue
Block a user