예제 #1
0
 public function testAddDocumentWithDocumentBoost()
 {
     // 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="false" overwritePending="true" overwriteCommitted="true"><doc boost="2"><field name="guid">global unique id</field><field name="field">value</field></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);
     $document = new Apache_Solr_Document();
     $document->setBoost(2);
     $document->guid = "global unique id";
     $document->field = "value";
     $fixture->addDocument($document);
 }
예제 #2
0
 public function testAddDocumentWithDocumentBoost()
 {
     // 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);
     $document = new Apache_Solr_Document();
     $document->setBoost(2);
     $document->guid = "global unique id";
     $document->field = "value";
     $fixture->addDocument($document);
 }