Пример #1
0
 public function checkRSSEntryNode(\DOMXPath $xpath, Feed $feed)
 {
     $list_entries = $xpath->query("/rss/channel/item");
     $count = 0;
     $offset_start = 0;
     $n_entries = 20;
     $entries = $feed->getEntries()->slice($offset_start, $n_entries);
     foreach ($list_entries as $node) {
         if (sizeof($entries) == 0) {
             $offset_start += $n_entries;
             $entries = $feed->getEntries()->slice($offset_start, $n_entries);
             if (sizeof($entries) == 0) {
                 //no more
                 break;
             }
         }
         $feed_entry = array_shift($entries);
         switch ($node->nodeName) {
             case 'title':
                 $this->assertEquals($feed_entry->getTitle(), $node->nodeValue);
                 break;
             case 'description':
                 $this->assertEquals($feed_entry->getSubtitle(), $node->nodeValue);
                 break;
             case 'author':
                 $author = sprintf('%s (%s)', $feed_entry->getAuthorEmail(), $feed_entry->getAuthorName());
                 $this->assertEquals($author, $node->nodeValue);
                 break;
             case 'pubDate':
                 $this->assertEquals($feed_entry->getCreatedOn()->format(DATE_RFC2822), $node->nodeValue);
                 break;
             case 'guid':
                 $this->assertEquals($feed_entry->getLink()->getURI(), $node->nodeValue);
                 break;
             case 'link':
                 $this->assertEquals($feed_entry->getLink()->getURI(), $node->nodeValue);
                 break;
         }
         $count++;
         $this->checkRSSEntryItemsNode($xpath, $feed_entry, $count);
     }
     $this->assertEquals($feed->getCountTotalEntries(), $count);
 }
 /**
  * {@inheritDoc}
  */
 public function getEntries($offset_start = 0, $how_many = NULL)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getEntries', array($offset_start, $how_many));
     return parent::getEntries($offset_start, $how_many);
 }