_parser = new Solarium_Client_ResponseParser_Select_Component_Spellcheck(); } public function testParseExtended() { $data = array( 'spellcheck' => array( 'suggestions' => array( 0 => 'delll', 1 => array ( 'numFound' => 1, 'startOffset' => 0, 'endOffset' => 5, 'origFreq' => 0, 'suggestion' => array ( 0 => array ( 'word' => 'dell', 'freq' => 1 ), ), ), 2 => 'ultrashar', 3 => array ( 'numFound' => 1, 'startOffset' => 6, 'endOffset' => 15, 'origFreq' => 0, 'suggestion' => array ( 0 => array ( 'word' => 'ultrasharp', 'freq' => 1 ), ), ), 4 => 'correctlySpelled', 5 => false, 6 => 'collation', 7 => array ( 0 => 'collationQuery', 1 => 'dell ultrasharp', 2 => 'hits', 3 => 0, 4 => 'misspellingsAndCorrections', 5 => array ( 0 => 'delll', 1 => 'dell', 2 => 'ultrashar', 3 => 'ultrasharp' ), ), ) ) ); $result = $this->_parser->parse(null, null, $data); $suggestions = $result->getSuggestions(); $this->assertEquals(false, $result->getCorrectlySpelled()); $this->assertEquals('dell', $suggestions[0]->getWord()); $this->assertEquals('dell ultrasharp', $result->getCollation()->getQuery()); } public function testParse() { $data = array( 'spellcheck' => array( 'suggestions' => array( 0 => 'delll', 1 => array ( 'numFound' => 1, 'startOffset' => 0, 'endOffset' => 5, 'origFreq' => 0, 'suggestion' => array ( 0 => 'dell', ), ), 2 => 'ultrashar', 3 => array ( 'numFound' => 1, 'startOffset' => 6, 'endOffset' => 15, 'origFreq' => 0, 'suggestion' => array ( 0 => array ( 'word' => 'ultrasharp', 'freq' => 1 ), ), ), 4 => 'correctlySpelled', 5 => false, 6 => 'collation', 7 => 'dell ultrasharp', ) ) ); $result = $this->_parser->parse(null, null, $data); $suggestions = $result->getSuggestions(); $this->assertEquals(false, $result->getCorrectlySpelled()); $this->assertEquals('dell', $suggestions[0]->getWord()); $this->assertEquals('dell ultrasharp', $result->getCollation()->getQuery()); } public function testParseNoData() { $result = $this->_parser->parse(null, null, array()); $this->assertEquals(null, $result); } }