Esempio n. 1
0
 public function testZPopRangeByScore()
 {
     $key = 'foo';
     $this->_client->zAdd($key, 1, 'foo');
     $this->_client->zAdd($key, 1.5, 'bar');
     $this->_client->zAdd($key, 2, 'foobar');
     $this->assertSame(array('foo', 'bar', 'foobar'), $this->_client->zRangeByScore($key, '1', '2'));
     $removedValues = $this->_client->zPopRangeByScore($key, '1.2', '1.8');
     $this->assertSame(array('bar'), $removedValues);
     $this->assertSame(2, $this->_client->zCard($key));
     $removedValues = $this->_client->zPopRangeByScore($key, '0.8', '1.2', true);
     $this->assertSame(array('foo', '1'), $removedValues);
     $this->assertSame(1, $this->_client->zCard($key));
 }