public function testWithSpecificEndpointOption() { $result = $this->getResult(); $mockClient = $this->getMock('Solarium\\Core\\Client\\Client', array('execute')); $mockClient->expects($this->exactly(1))->method('execute')->with($this->equalTo($this->query), $this->equalTo('s3'))->will($this->returnValue($result)); $this->plugin->initPlugin($mockClient, array('endpoint' => 's3')); $this->plugin->setQuery($this->query); $this->assertEquals(5, count($this->plugin)); }
public function testIteratorAndRewind() { $result = $this->getResult(); $mockClient = $this->getMock('Solarium\\Core\\Client\\Client', array('execute')); $mockClient->expects($this->exactly(1))->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; } // the second foreach will trigger a rewind, this time include keys $results2 = array(); foreach ($this->plugin as $key => $doc) { $results2[$key] = $doc; } $this->assertEquals($result->getDocuments(), $results1); $this->assertEquals($result->getDocuments(), $results2); }