mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-05 02:24:35 +02:00
feat: support itunes namespace in top channel feed (#3776)
Also preserves other properties.
This commit is contained in:
parent
ea58c8d2bc
commit
3ce94409ab
22 changed files with 298 additions and 203 deletions
72
tests/FormatTest.php
Normal file
72
tests/FormatTest.php
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace RssBridge\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FormatTest extends TestCase
|
||||
{
|
||||
public function testBridge()
|
||||
{
|
||||
$sut = new \MrssFormat();
|
||||
|
||||
$expected = [
|
||||
'name' => '',
|
||||
'uri' => '',
|
||||
'icon' => '',
|
||||
'donationUri' => '',
|
||||
];
|
||||
$this->assertEquals([], $sut->getFeed());
|
||||
|
||||
$sut->setFeed([
|
||||
'name' => '0',
|
||||
'uri' => '1',
|
||||
'icon' => '2',
|
||||
'donationUri' => '3',
|
||||
]);
|
||||
$expected = [
|
||||
'name' => '0',
|
||||
'uri' => '1',
|
||||
'icon' => '2',
|
||||
'donationUri' => '3',
|
||||
];
|
||||
$this->assertEquals($expected, $sut->getFeed());
|
||||
|
||||
$sut->setFeed([]);
|
||||
$expected = [
|
||||
'name' => '',
|
||||
'uri' => '',
|
||||
'icon' => '',
|
||||
'donationUri' => '',
|
||||
];
|
||||
$this->assertEquals($expected, $sut->getFeed());
|
||||
|
||||
$sut->setFeed(['foo' => 'bar', 'foo2' => 'bar2']);
|
||||
$expected = [
|
||||
'name' => '',
|
||||
'uri' => '',
|
||||
'icon' => '',
|
||||
'donationUri' => '',
|
||||
'foo' => 'bar',
|
||||
'foo2' => 'bar2',
|
||||
];
|
||||
$this->assertEquals($expected, $sut->getFeed());
|
||||
}
|
||||
}
|
||||
|
||||
class TestFormat extends \FormatAbstract
|
||||
{
|
||||
public function stringify()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class TestBridge extends \BridgeAbstract
|
||||
{
|
||||
public function collectData()
|
||||
{
|
||||
$this->items[] = ['title' => 'kek'];
|
||||
}
|
||||
}
|
|
@ -61,7 +61,7 @@ abstract class BaseFormatTest extends TestCase
|
|||
$formatFactory = new FormatFactory();
|
||||
$format = $formatFactory->create($formatName);
|
||||
$format->setItems($sample->items);
|
||||
$format->setExtraInfos($sample->meta);
|
||||
$format->setFeed($sample->meta);
|
||||
$format->setLastModified(strtotime('2000-01-01 12:00:00 UTC'));
|
||||
|
||||
return $format->stringify();
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
|
||||
|
||||
<title type="text">Sample feed with common data</title>
|
||||
<id>https://example.com/feed?type=common&items=4</id>
|
||||
<link href="https://example.com/blog/" rel="alternate" type="text/html"/>
|
||||
<link href="https://example.com/feed?type=common&items=4" rel="self" type="application/atom+xml"/>
|
||||
<icon>https://example.com/logo.png</icon>
|
||||
<logo>https://example.com/logo.png</logo>
|
||||
<id>https://example.com/feed?type=common&items=4</id>
|
||||
<updated>2000-01-01T12:00:00+00:00</updated>
|
||||
<author>
|
||||
<name>RSS-Bridge</name>
|
||||
</author>
|
||||
<link href="https://example.com/blog/" rel="alternate" type="text/html"/>
|
||||
<link href="https://example.com/feed?type=common&items=4" rel="self" type="application/atom+xml"/>
|
||||
|
||||
<entry>
|
||||
<title type="html">Test Entry</title>
|
||||
|
|
|
@ -2,14 +2,12 @@
|
|||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
|
||||
|
||||
<title type="text">Sample feed with minimum data</title>
|
||||
<link href="https://github.com/RSS-Bridge/rss-bridge/" rel="alternate" type="text/html"/>
|
||||
<link href="https://example.com/feed" rel="self" type="application/atom+xml"/>
|
||||
<id>https://example.com/feed</id>
|
||||
<icon>https://github.com/favicon.ico</icon>
|
||||
<logo>https://github.com/favicon.ico</logo>
|
||||
<updated>2000-01-01T12:00:00+00:00</updated>
|
||||
<author>
|
||||
<name>RSS-Bridge</name>
|
||||
</author>
|
||||
<link href="https://github.com/RSS-Bridge/rss-bridge/" rel="alternate" type="text/html"/>
|
||||
<link href="https://example.com/feed" rel="self" type="application/atom+xml"/>
|
||||
|
||||
</feed>
|
||||
|
|
|
@ -2,15 +2,13 @@
|
|||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
|
||||
|
||||
<title type="text">Sample feed with minimum data</title>
|
||||
<link href="https://github.com/RSS-Bridge/rss-bridge/" rel="alternate" type="text/html"/>
|
||||
<link href="https://example.com/feed" rel="self" type="application/atom+xml"/>
|
||||
<id>https://example.com/feed</id>
|
||||
<icon>https://github.com/favicon.ico</icon>
|
||||
<logo>https://github.com/favicon.ico</logo>
|
||||
<updated>2000-01-01T12:00:00+00:00</updated>
|
||||
<author>
|
||||
<name>RSS-Bridge</name>
|
||||
</author>
|
||||
<link href="https://github.com/RSS-Bridge/rss-bridge/" rel="alternate" type="text/html"/>
|
||||
<link href="https://example.com/feed" rel="self" type="application/atom+xml"/>
|
||||
|
||||
<entry>
|
||||
<title type="html">Sample Item #1</title>
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
|
||||
|
||||
<title type="text">Sample microblog feed</title>
|
||||
<id>https://example.com/feed</id>
|
||||
<link href="https://example.com/blog/" rel="alternate" type="text/html"/>
|
||||
<link href="https://example.com/feed" rel="self" type="application/atom+xml"/>
|
||||
<icon>https://example.com/logo.png</icon>
|
||||
<logo>https://example.com/logo.png</logo>
|
||||
<id>https://example.com/feed</id>
|
||||
<updated>2000-01-01T12:00:00+00:00</updated>
|
||||
<author>
|
||||
<name>RSS-Bridge</name>
|
||||
</author>
|
||||
<link href="https://example.com/blog/" rel="alternate" type="text/html"/>
|
||||
<link href="https://example.com/feed" rel="self" type="application/atom+xml"/>
|
||||
|
||||
<entry>
|
||||
<title type="html">Oh 😲 I found three monkeys 🙈🙉🙊</title>
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
|
||||
<channel>
|
||||
<title>Sample feed with common data</title>
|
||||
<link>https://example.com/blog/</link>
|
||||
<description>Sample feed with common data</description>
|
||||
<link>https://example.com/blog/</link>
|
||||
<atom:link href="https://example.com/blog/" rel="alternate" type="text/html"/>
|
||||
<atom:link href="https://example.com/feed?type=common&items=4" rel="self" type="application/atom+xml"/>
|
||||
<image>
|
||||
<url>https://example.com/logo.png</url>
|
||||
<title>Sample feed with common data</title>
|
||||
<link>https://example.com/blog/</link>
|
||||
</image>
|
||||
<atom:link href="https://example.com/blog/" rel="alternate" type="text/html"/>
|
||||
<atom:link href="https://example.com/feed?type=common&items=4" rel="self" type="application/atom+xml"/>
|
||||
|
||||
<item>
|
||||
<title>Test Entry</title>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
|
||||
<channel>
|
||||
<title>Sample feed with minimum data</title>
|
||||
<link>https://github.com/RSS-Bridge/rss-bridge/</link>
|
||||
<description>Sample feed with minimum data</description>
|
||||
<link>https://github.com/RSS-Bridge/rss-bridge/</link>
|
||||
<atom:link href="https://github.com/RSS-Bridge/rss-bridge/" rel="alternate" type="text/html"/>
|
||||
<atom:link href="https://example.com/feed" rel="self" type="application/atom+xml"/>
|
||||
</channel>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
|
||||
<channel>
|
||||
<title>Sample feed with minimum data</title>
|
||||
<link>https://github.com/RSS-Bridge/rss-bridge/</link>
|
||||
<description>Sample feed with minimum data</description>
|
||||
<link>https://github.com/RSS-Bridge/rss-bridge/</link>
|
||||
<atom:link href="https://github.com/RSS-Bridge/rss-bridge/" rel="alternate" type="text/html"/>
|
||||
<atom:link href="https://example.com/feed" rel="self" type="application/atom+xml"/>
|
||||
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
|
||||
<channel>
|
||||
<title>Sample microblog feed</title>
|
||||
<link>https://example.com/blog/</link>
|
||||
<description>Sample microblog feed</description>
|
||||
<link>https://example.com/blog/</link>
|
||||
<atom:link href="https://example.com/blog/" rel="alternate" type="text/html"/>
|
||||
<atom:link href="https://example.com/feed" rel="self" type="application/atom+xml"/>
|
||||
<image>
|
||||
<url>https://example.com/logo.png</url>
|
||||
<title>Sample microblog feed</title>
|
||||
<link>https://example.com/blog/</link>
|
||||
</image>
|
||||
<atom:link href="https://example.com/blog/" rel="alternate" type="text/html"/>
|
||||
<atom:link href="https://example.com/feed" rel="self" type="application/atom+xml"/>
|
||||
|
||||
<item>
|
||||
<guid isPermaLink="false">1918f084648b82057c1dd3faa3d091da82a6fac2</guid>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
},
|
||||
"meta": {
|
||||
"name": "Sample feed with minimum data",
|
||||
"uri": "",
|
||||
"uri": "https://github.com/RSS-Bridge/rss-bridge/",
|
||||
"icon": ""
|
||||
},
|
||||
"items": []
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
},
|
||||
"meta": {
|
||||
"name": "Sample feed with minimum data",
|
||||
"uri": "",
|
||||
"uri": "https://github.com/RSS-Bridge/rss-bridge/",
|
||||
"icon": ""
|
||||
},
|
||||
"items": [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue