public function testBuildParams()
 {
     $this->_query->setInterestingTerms('test');
     $this->_query->setMatchInclude(true);
     $this->_query->setStart(12);
     $this->_query->setMltFields('description,name');
     $this->_query->setMinimumTermFrequency(1);
     $this->_query->setMinimumDocumentFrequency(3);
     $this->_query->setMinimumWordLength(2);
     $this->_query->setMaximumWordLength(15);
     $this->_query->setMaximumQueryTerms(4);
     $this->_query->setMaximumNumberOfTokens(5);
     $this->_query->setBoost(true);
     $this->_query->setQueryFields('description');
     $request = $this->_builder->build($this->_query);
     $this->assertEquals(array('mlt.interestingTerms' => 'test', 'mlt.match.include' => 'true', 'mlt.match.offset' => 12, 'mlt.fl' => 'description,name', 'mlt.mintf' => 1, 'mlt.mindf' => 3, 'mlt.minwl' => 2, 'mlt.maxwl' => 15, 'mlt.maxqt' => 4, 'mlt.maxntp' => 5, 'mlt.boost' => 'true', 'mlt.qf' => 'description', 'q' => '*:*', 'fl' => '*,score', 'rows' => 10, 'start' => 12, 'wt' => 'json'), $request->getParams());
     $this->assertEquals(Solarium_Client_Request::METHOD_GET, $request->getMethod());
 }
 public function testGetInterestingTermsException()
 {
     $query = new Solarium_Query_MoreLikeThis();
     $query->setInterestingTerms('none');
     $mock = $this->getMock('Solarium_Result_MoreLikeThis', array('getQuery'), array(), '', false);
     $mock->expects($this->once())->method('getQuery')->will($this->returnValue($query));
     $this->setExpectedException('Solarium_Exception');
     $mock->getInterestingTerms();
 }
 public function testParse()
 {
     $data = array('response' => array('docs' => array(array('fieldA' => 1, 'fieldB' => 'Test'), array('fieldA' => 2, 'fieldB' => 'Test2')), 'numFound' => 503), 'responseHeader' => array('status' => 1, 'QTime' => 13), 'interestingTerms' => array('key1', 'value1', 'key2', 'value2'), 'match' => array('docs' => array(array('fieldA' => 5, 'fieldB' => 'Test5'))));
     $query = new Solarium_Query_MoreLikeThis();
     $query->setInterestingTerms('details');
     $query->setMatchInclude(true);
     $resultStub = $this->getMock('Solarium_Result_MoreLikeThis', array(), array(), '', false);
     $resultStub->expects($this->any())->method('getData')->will($this->returnValue($data));
     $resultStub->expects($this->any())->method('getQuery')->will($this->returnValue($query));
     $parser = new Solarium_Client_ResponseParser_MoreLikeThis();
     $result = $parser->parse($resultStub);
     $this->assertEquals(array('key1' => 'value1', 'key2' => 'value2'), $result['interestingTerms']);
     $this->assertEquals(5, $result['match']->fieldA);
 }