Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0081e4d

Browse files
committed
added testcase
1 parent 2e1a03c commit 0081e4d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/TestRedis.php

+16
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,22 @@ public function testZX() {
17941794
$this->redis->delete('key2');
17951795
$this->redis->delete('key3');
17961796

1797+
$this->redis->zadd('key1', 2000.1, 'one');
1798+
$this->redis->zadd('key1', 3000.1, 'two');
1799+
$this->redis->zadd('key1', 4000.1, 'three');
1800+
1801+
$ret = $this->redis->zRange('key1', 0, -1, TRUE);
1802+
$this->assertTrue(count($ret) === 3);
1803+
$retValues = array_keys($ret);
1804+
1805+
$this->assertTrue(array('one', 'two', 'three') === $retValues);
1806+
1807+
// + 0 converts from string to float OR integer
1808+
$this->assertTrue(is_float($ret['one'] + 0));
1809+
$this->assertTrue(is_float($ret['two'] + 0));
1810+
$this->assertTrue(is_float($ret['three'] + 0));
1811+
1812+
$this->redis->delete('key1');
17971813

17981814
// ZREMRANGEBYRANK
17991815
$this->redis->zAdd('key1', 1, 'one');

0 commit comments

Comments
 (0)