function testGetResults()
 {
     $testResults = array();
     for ($i = 0; $i < 10; $i++) {
         $testResult = new GoogleResult();
         $testResult->setTitle('Title ' . $i);
         $this->myGoogleResultPage->addResult($testResult);
     }
     $actualResultArray = $this->myGoogleResultPage->getResults();
     $this->assertEquals("Title 2", $actualResultArray[2]->getTitle());
 }
 private function ReadResults()
 {
     $this->_googleResultPage = new GoogleResultPage();
     $doc = new DOMDocument();
     while ($this->_resultsXMLReader->read() && $this->_resultsXMLReader->name !== 'R') {
     }
     while ($this->_resultsXMLReader->name === 'R') {
         $node = simplexml_import_dom($doc->importNode($this->_resultsXMLReader->expand(), true));
         $result = new GoogleResult();
         $result->setRank((int) $node['N']);
         $result->setUrl(trim((string) $node->U));
         $result->setTitle(trim(preg_replace('/\\s+/', ' ', (string) $node->T)));
         $result->setSnippet(trim(preg_replace('/\\s+/', ' ', (string) $node->S)));
         $this->_googleResultPage->addResult($result);
         $this->_resultsXMLReader->next('R');
     }
 }