Ejemplo n.º 1
0
 /**
  * Test getting a range by score in reverse order
  */
 public function testZrevrangebyscore()
 {
     $this->redis->del('testZrevrangebyscore');
     $this->assertEquals(1, $this->redis->zadd('testZrevrangebyscore', 1, 'one'));
     $this->assertEquals(1, $this->redis->zadd('testZrevrangebyscore', 2, 'two'));
     $this->assertEquals(1, $this->redis->zadd('testZrevrangebyscore', 3, 'three'));
     $this->assertEquals(array('three', 'two', 'one'), $this->redis->zrevrangebyscore('testZrevrangebyscore', '+inf', '-inf'));
     $this->assertEquals(array('two', 'one'), $this->redis->zrevrangebyscore('testZrevrangebyscore', 2, 1));
     $this->assertEquals(array('two'), $this->redis->zrevrangebyscore('testZrevrangebyscore', 2, '(1'));
     $this->assertEquals(array(), $this->redis->zrevrangebyscore('testZrevrangebyscore', '(2', '(1'));
     $this->assertEquals(array('three' => 3, 'two' => 2, 'one' => 1), $this->redis->zrevrangebyscore('testZrevrangebyscore', '+inf', '-inf', array('withscores' => true)));
     $this->assertEquals(array('three' => 3), $this->redis->zrevrangebyscore('testZrevrangebyscore', '+inf', '-inf', array('withscores' => true, 'limit' => array(0, 1))));
 }