コード例 #1
0
ファイル: LuceneTest.php プロジェクト: JellyBellyDev/zle
 public function testPaginatorUsesCacheIfSetForInstance()
 {
     $index = $this->getIndex();
     $q = Zend_Search_Lucene_Search_QueryParser::parse('foo');
     $result = array_fill(0, 10, 'page1') + array_fill(10, 10, 'page2');
     $index->expects($this->once())->method('find')->will($this->returnValue($result));
     $a1 = new Zle_Paginator_Adapter_Lucene($index, $q);
     $a1->setCache($this->getCache());
     $a2 = new Zle_Paginator_Adapter_Lucene($index, $q);
     $a2->setCache($this->getCache());
     // do searches with different instances of adapter
     $this->assertEquals($a1->getItems(0, 10), $a2->getItems(0, 10));
     $this->assertEquals(array_fill(0, 10, 'page2'), $a2->getItems(10, 10));
 }