Exemplo n.º 1
0
 public function testSetAndGetFieldBoostWithNonNumberRemovesBoost()
 {
     $field = 'field';
     $boost = "i am not a number";
     $this->_fixture->setFieldBoost($field, $boost);
     // test the field boost
     $this->assertTrue($this->_fixture->getFieldBoost($field) === false);
 }
Exemplo n.º 2
0
 public function testExtractsWithDocument()
 {
     $extractFile = __FILE__;
     $expectedUrl = "http://localhost:8180/solr/update/extract?resource.name=ServiceTest.php&wt=json&json.nl=map&boost.field=2&literal.field=literal+value";
     $expectedPostData = file_get_contents($extractFile);
     $expectedContentType = 'application/octet-stream';
     // default for extract
     $expectedTimeout = false;
     // set a mock transport
     $mockTransport = $this->getMockHttpTransportInterface();
     // setup expected call and response
     $mockTransport->expects($this->once())->method('performPostRequest')->with($this->equalTo($expectedUrl), $this->equalTo($expectedPostData), $this->equalTo($expectedContentType), $this->equalTo($expectedTimeout))->will($this->returnValue(Apache_Solr_HttpTransport_ResponseTest::get200Response()));
     $fixture = new Apache_Solr_Service();
     $fixture->setHttpTransport($mockTransport);
     $literals = new Apache_Solr_Document();
     $literals->field = "literal value";
     $literals->setFieldBoost('field', 2);
     $fixture->extract($extractFile, null, $literals);
 }