Extended the tests for ZRANGE and ZREVRANGE to cover the newly added "WITHSCORES" option.

This commit is contained in:
Daniele Alessandri
2009-12-23 22:05:04 +01:00
parent 822a3e56e2
commit 627433cef8
+15
View File
@@ -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);