public function testGetResultSet()
 {
     $query = $this->createQueryMock();
     $client = $this->createClientMock();
     $client->expects($this->atLeastOnce())->method('select')->will($this->returnValue($this->createResultMock()));
     $adapter = new SolariumAdapter($client, $query);
     $this->assertInstanceOf($this->getResultClass(), $adapter->getResultSet());
 }
예제 #2
0
 public function testGetSliceCannotUseACachedResultSet()
 {
     $query = $this->createQueryStub();
     $client = $this->createClientMock();
     $client->expects($this->exactly(2))->method('select')->will($this->returnValue($this->createResultMock()));
     $adapter = new SolariumAdapter($client, $query);
     $adapter->getNbResults();
     $adapter->getSlice(1, 200);
 }
 public function testGetSlice()
 {
     $query = $this->getSolariumQueryMock();
     $query->expects($this->any())->method('setStart')->with(1)->will($this->returnValue($query));
     $query->expects($this->any())->method('setRows')->with(200)->will($this->returnValue($query));
     $client = $this->getSolariumClientMock();
     $client->expects($this->once())->method('select')->with($query)->will($this->returnValue($this->getSolariumResultMock()));
     $adapter = new SolariumAdapter($client, $query);
     $adapter->getSlice(1, 200);
 }
예제 #4
0
 private function doTestGetResultSet($query, $endPoint)
 {
     $client = $this->createClientMock();
     $client->expects($this->atLeastOnce())->method('select')->with($query, $endPoint)->will($this->returnValue($this->createResultMock()));
     $adapter = new SolariumAdapter($client, $query);
     if ($endPoint !== null) {
         $adapter->setEndPoint($endPoint);
     }
     $this->assertInstanceOf($this->getResultClass(), $adapter->getResultSet());
 }