_name = 'testname'; $this->_items = array( 'index' => new testAnalysisTypeIndexDummy(), 'query' => new testAnalysisTypeQueryDummy() ); $this->_result = new Solarium_Result_Analysis_Types($this->_name, $this->_items); } public function testGetItems() { $this->assertEquals($this->_items, $this->_result->getItems()); } public function testCount() { $this->assertEquals(count($this->_items), count($this->_result)); } public function testIterator() { $lists = array(); foreach($this->_result AS $key => $list) { $lists[$key] = $list; } $this->assertEquals($this->_items, $lists); } public function testGetName() { $this->assertEquals( $this->_name, $this->_result->getName() ); } public function testGetIndexAnalysis() { $this->assertEquals( $this->_items['index'], $this->_result->getIndexAnalysis() ); } public function testGetIndexAnalysisNoData() { $items = array( 'index' => new testAnalysisTypeInvalidDummy(), 'query' => new testAnalysisTypeQueryDummy() ); $result = new Solarium_Result_Analysis_Types($this->_name, $items); $this->assertEquals( null, $result->getIndexAnalysis() ); } public function testGetQueryAnalysis() { $this->assertEquals( $this->_items['query'], $this->_result->getQueryAnalysis() ); } public function testGetQueryAnalysisNoData() { $items = array( 'index' => new testAnalysisTypeIndexDummy(), 'query' => new testAnalysisTypeInvalidDummy() ); $result = new Solarium_Result_Analysis_Types($this->_name, $items); $this->assertEquals( null, $result->getQueryAnalysis() ); } } class testAnalysisTypeIndexDummy{ public function getName(){ return 'index'; } } class testAnalysisTypeQueryDummy{ public function getName(){ return 'query'; } } class testAnalysisTypeInvalidDummy{ public function getName(){ return 'invalid'; } }