예제 #1
0
 public function testAddDocumentsWithNonDefaultParameters()
 {
     // set a mock transport
     $mockTransport = $this->getMockHttpTransportInterface();
     // setup expected call and response
     $mockTransport->expects($this->once())->method('performPostRequest')->with($this->equalTo('http://localhost:8180/solr/update?wt=json'), $this->equalTo('<add allowDups="true" overwritePending="false" overwriteCommitted="false" commitWithin="3600"><doc></doc><doc></doc></add>'), $this->equalTo('text/xml; charset=UTF-8'), $this->equalTo(false))->will($this->returnValue(Apache_Solr_HttpTransport_ResponseTest::get200Response()));
     $fixture = new Apache_Solr_service();
     $fixture->setHttpTransport($mockTransport);
     $documents = array(new Apache_Solr_Document(), new Apache_Solr_Document());
     $fixture->addDocuments($documents, true, false, false, 3600);
 }
예제 #2
0
 public function testAddDocuments()
 {
     // set a mock transport
     $mockTransport = $this->getMockHttpTransportInterface();
     // setup expected call and response
     $mockTransport->expects($this->once())->method('performPostRequest')->will($this->returnValue(Apache_Solr_HttpTransport_ResponseTest::get200Response()));
     $fixture = new Apache_Solr_service();
     $fixture->setHttpTransport($mockTransport);
     $documents = array(new Apache_Solr_Document(), new Apache_Solr_Document());
     $fixture->addDocuments($documents);
 }