public function testSetXSSLink() { $feed = new Feed(); $feed->setLink('javascript:alert()'); $this->assertEquals('', $feed->getLink()); }
public function testToExport() { $item = new Item(); $item->setId(3); $item->setGuid('guid'); $item->setGuidHash('hash'); $item->setUrl('https://google'); $item->setTitle('title'); $item->setAuthor('author'); $item->setPubDate(123); $item->setBody('body'); $item->setEnclosureMime('audio/ogg'); $item->setEnclosureLink('enclink'); $item->setFeedId(1); $item->setRtl(true); $item->setStatus(0); $item->setRead(); $item->setStarred(); $item->setLastModified(321); $feed = new Feed(); $feed->setLink('http://test'); $feeds = ["feed1" => $feed]; $this->assertEquals(['guid' => 'guid', 'url' => 'https://google', 'title' => 'title', 'author' => 'author', 'pubDate' => 123, 'body' => 'body', 'enclosureMime' => 'audio/ogg', 'enclosureLink' => 'enclink', 'unread' => false, 'starred' => true, 'feedLink' => 'http://test', 'rtl' => true], $item->toExport($feeds)); }
public function testFromImport() { $item = new Item(); $item->setGuid('guid'); $item->setUrl('https://google'); $item->setTitle('title'); $item->setAuthor('author'); $item->setPubDate(123); $item->setBody('body'); $item->setEnclosureMime('audio/ogg'); $item->setEnclosureLink('enclink'); $item->setFeedId(1); $item->setUnread(); $item->setStarred(); $feed = new Feed(); $feed->setLink('http://test'); $feeds = array("feed1" => $feed); $compareWith = Item::fromImport($item->toExport($feeds)); $item->setFeedId(null); $this->assertEquals($item, $compareWith); }