_numFound = 11; $this->_docs = array( new Solarium_Document_ReadOnly(array('id'=>1,'title'=>'doc1')), new Solarium_Document_ReadOnly(array('id'=>1,'title'=>'doc1')), ); $this->_facetSet = 'dummy-facetset-value'; $this->_moreLikeThis = 'dummy-facetset-value'; $this->_highlighting = 'dummy-highlighting-value'; $this->_grouping = 'dummy-grouping-value'; $this->_spellcheck = 'dummy-grouping-value'; $this->_stats = 'dummy-stats-value'; $this->_debug = 'dummy-debug-value'; $this->_components = array( Solarium_Query_Select::COMPONENT_FACETSET => $this->_facetSet, Solarium_Query_Select::COMPONENT_MORELIKETHIS => $this->_moreLikeThis, Solarium_Query_Select::COMPONENT_HIGHLIGHTING => $this->_highlighting, Solarium_Query_Select::COMPONENT_GROUPING => $this->_grouping, Solarium_Query_Select::COMPONENT_SPELLCHECK => $this->_spellcheck, Solarium_Query_Select::COMPONENT_STATS => $this->_stats, Solarium_Query_Select::COMPONENT_DEBUG => $this->_debug, ); $this->_result = new Solarium_Result_SelectDummy(1, 12, $this->_numFound, $this->_docs, $this->_components); } public function testGetNumFound() { $this->assertEquals($this->_numFound, $this->_result->getNumFound()); } public function testGetDocuments() { $this->assertEquals($this->_docs, $this->_result->getDocuments()); } public function testGetFacetSet() { $this->assertEquals($this->_facetSet, $this->_result->getFacetSet()); } public function testCount() { $this->assertEquals(count($this->_docs), count($this->_result)); } public function testGetComponents() { $this->assertEquals($this->_components, $this->_result->getComponents()); } public function testGetComponent() { $this->assertEquals( $this->_components[Solarium_Query_Select::COMPONENT_MORELIKETHIS], $this->_result->getComponent(Solarium_Query_Select::COMPONENT_MORELIKETHIS) ); } public function testGetInvalidComponent() { $this->assertEquals( null, $this->_result->getComponent('invalid') ); } public function testGetMoreLikeThis() { $this->assertEquals( $this->_components[Solarium_Query_Select::COMPONENT_MORELIKETHIS], $this->_result->getMoreLikeThis() ); } public function testGetHighlighting() { $this->assertEquals( $this->_components[Solarium_Query_Select::COMPONENT_HIGHLIGHTING], $this->_result->getHighlighting() ); } public function testGetGrouping() { $this->assertEquals( $this->_components[Solarium_Query_Select::COMPONENT_GROUPING], $this->_result->getGrouping() ); } public function testGetSpellcheck() { $this->assertEquals( $this->_components[Solarium_Query_Select::COMPONENT_SPELLCHECK], $this->_result->getSpellcheck() ); } public function testGetStats() { $this->assertEquals( $this->_components[Solarium_Query_Select::COMPONENT_STATS], $this->_result->getStats() ); } public function testGetDebug() { $this->assertEquals( $this->_components[Solarium_Query_Select::COMPONENT_DEBUG], $this->_result->getDebug() ); } public function testIterator() { $docs = array(); foreach($this->_result AS $key => $doc) { $docs[$key] = $doc; } $this->assertEquals($this->_docs, $docs); } public function testGetStatus() { $this->assertEquals( 1, $this->_result->getStatus() ); } public function testGetQueryTime() { $this->assertEquals( 12, $this->_result->getQueryTime() ); } } class Solarium_Result_SelectDummy extends Solarium_Result_Select { protected $_parsed = true; public function __construct($status, $queryTime, $numfound, $docs, $components) { $this->_numfound = $numfound; $this->_documents = $docs; $this->_components = $components; $this->_queryTime = $queryTime; $this->_status = $status; } }