$enclosure */ private static function renderEntryWithEnclosure(array $enclosure): string { $entry = new FreshRSS_Entry(1, 'guid', 'Title', '', 'Content', 'https://example.net/article', 1700000000); $entry->_attribute('enclosures', [$enclosure]); $view = new FreshRSS_View(); $view->_path('index/rss.phtml'); $view->internal_rendering = true; $view->rss_title = 'Test'; $view->rss_url = 'https://example.net/rss'; $view->html_url = 'https://example.net/'; $view->description = 'Test'; $view->entries = [$entry]; return $view->renderToString(); } /** An enclosure with several `` must keep them all, see https://github.com/FreshRSS/FreshRSS/issues/5066 */ public function test_rss_multipleEnclosureCredits(): void { $rss = self::renderEntryWithEnclosure([ 'url' => 'https://example.net/audio.mp3', 'type' => 'audio/mpeg', 'credit' => ['Alice', 'Bob', 'Carol'], ]); self::assertStringContainsString( 'AliceBobCarol', $rss); } /** Entries older than FreshRSS 1.24 store a single credit as a string instead of an array */ public function test_rss_legacySingleEnclosureCredit(): void { $rss = self::renderEntryWithEnclosure([ 'url' => 'https://example.net/audio.mp3', 'type' => 'audio/mpeg', 'credit' => 'Alice', ]); self::assertStringContainsString('Alice', $rss); } /** BitTorrent enclosures must also be exposed as RSS 2.0 `` for clients that ignore Media RSS */ public function test_rss_enclosureForBitTorrent(): void { $rss = self::renderEntryWithEnclosure([ 'url' => 'https://example.net/file.torrent', 'type' => 'application/x-bittorrent', 'length' => 12216, ]); self::assertStringContainsString( '', $rss); } /** A magnet link is a torrent even without a MIME type */ public function test_rss_enclosureForMagnetWithoutType(): void { $rss = self::renderEntryWithEnclosure([ 'url' => 'magnet:?xt=urn:btih:0123456789abcdef', ]); self::assertStringContainsString( '', $rss); } /** Images / audio / video must not be duplicated as RSS 2.0 `` */ public function test_rss_noEnclosureForImageAttachment(): void { $rss = self::renderEntryWithEnclosure([ 'url' => 'https://example.net/cover.jpg', 'type' => 'image/jpeg', 'medium' => 'image', ]); self::assertStringNotContainsString('