/** * Tests the JFeedEntry::setAuthor method. * * @return void * * @since 12.3 */ public function testSetAuthor() { $this->_instance->setAuthor('Sir John A. Macdonald', '*****@*****.**'); $properties = TestReflection::getValue($this->_instance, 'properties'); $this->assertInstanceOf('JFeedPerson', $properties['author']); $this->assertEquals('Sir John A. Macdonald', $properties['author']->name); $this->assertEquals('*****@*****.**', $properties['author']->email); }
/** * Method to handle the feed entry element for the feed: <item>. * * @param JFeedEntry $entry The JFeedEntry object being built from the parsed feed entry. * @param SimpleXMLElement $el The current XML element object to handle. * * @return void * * @since 12.3 */ protected function processFeedEntry(JFeedEntry $entry, SimpleXMLElement $el) { $entry->uri = (string) $el->link; $entry->title = (string) $el->title; $entry->publishedDate = (string) $el->pubDate; $entry->updatedDate = (string) $el->pubDate; $entry->content = (string) $el->description; $entry->guid = (string) $el->guid; $entry->comments = (string) $el->comments; // Add the feed entry author if available. $author = (string) $el->author; if (!empty($author)) { $entry->author = $this->processPerson($author); } // Add any categories to the entry. foreach ($el->category as $category) { $entry->addCategory((string) $category, (string) $category['domain']); } // Add any enclosures to the entry. foreach ($el->enclosure as $enclosure) { $link = new JFeedLink((string) $enclosure['url'], null, (string) $enclosure['type'], null, null, (int) $enclosure['length']); $entry->addLink($link); } }