protected function setUp() { $this->feed = new FeedContent(); $this->feed->setPublicId('feed id'); $this->feed->setLink('http://example.com'); $this->feed->setTitle('feed title'); $this->feed->setDescription('feed subtitle'); $this->feed->setLastModified(new \DateTime()); $item = new Item(); $item->setPublicId('item id'); $item->setLink('http://example.com/1'); $item->setSummary('lorem ipsum'); $item->setTitle('title 1'); $item->setUpdated(new \DateTime()); $item->setComment('http://linktothecomments.com'); $item->setAuthor('Contributor'); $media = new Media(); $media->setUrl('http://media'); $media->setUrl('image/jpeg'); $item->addMedia($media); $this->feed->addItem($item); }
/** * @param \SimpleXMLElement $element * * @return Media * @deprecated removed in version 3.0 */ public function createMedia(\SimpleXMLElement $element) { $media = new Media(); $media->setUrl($this->searchAttributeValue($element, array('url', 'href', 'link')))->setType($this->getAttributeValue($element, 'type'))->setLength($this->getAttributeValue($element, 'length')); return $media; }
/** * Parse elements from Yahoo RSS Media extension * * @param SimpleXMLElement $xmlElement * @param ItemInInterface $item with Media added */ protected function handleMediaExtension(SimpleXMLElement $xmlElement, ItemInInterface $item) { foreach ($xmlElement->children('http://search.yahoo.com/mrss/') as $xmlMedia) { $media = new Media(); $media->setUrl($this->getAttributeValue($xmlMedia, 'url'))->setType($this->searchAttributeValue($xmlMedia, array('type', 'medium')))->setLength($this->getAttributeValue($xmlMedia, 'fileSize')); $item->addMedia($media); } }
public function testSetUrl() { $this->object->setUrl('http://localhost/'); $this->assertEquals('http://localhost/', $this->object->getUrl()); }