예제 #1
0
파일: ListTest.php 프로젝트: cargomedia/cm
 public function testGet()
 {
     $source = new CM_PagingSource_Redis_List('foo');
     $this->assertSame(0, $source->getCount());
     $this->assertSame(array(), $source->getItems());
     $this->_client->rPush('foo', 'bar1');
     $this->_client->rPush('foo', 'bar2');
     $this->_client->rPush('foo', 'bar3');
     $this->assertSame(3, $source->getCount());
     $this->assertSame(array('bar1', 'bar2', 'bar3'), $source->getItems());
     $this->assertSame(array('bar2'), $source->getItems(1, 1));
 }
예제 #2
0
 public function testLRange()
 {
     $this->_client->rPush('foo', 'bar1');
     $this->_client->rPush('foo', 'bar2');
     $this->_client->rPush('foo', 'bar3');
     $this->assertSame(array('bar1', 'bar2', 'bar3'), $this->_client->lRange('foo'));
     $this->assertSame(array('bar2', 'bar3'), $this->_client->lRange('foo', 1));
     $this->assertSame(array('bar2'), $this->_client->lRange('foo', 1, 1));
 }