public function testIteratorResetOnSetPrefetch() { $result = $this->getResult(); $mockClient = $this->getMock('Solarium\\Core\\Client\\Client', array('execute')); $mockClient->expects($this->exactly(2))->method('execute')->will($this->returnValue($result)); $this->plugin->initPlugin($mockClient, array()); $this->plugin->setQuery($this->query); $results1 = array(); foreach ($this->plugin as $doc) { $results1[] = $doc; } $this->plugin->setPrefetch(1000); // the second foreach should trigger a reset and a second query execution (checked by mock) $results2 = array(); foreach ($this->plugin as $doc) { $results2[] = $doc; } $this->assertEquals($result->getDocuments(), $results1); $this->assertEquals($result->getDocuments(), $results2); }
public function testSetAndGetPrefetch() { $this->plugin->setPrefetch(120); $this->assertEquals(120, $this->plugin->getPrefetch()); }