Skip to content

Commit

Permalink
Merge pull request #183 from alexdebril/backport/issue-171
Browse files Browse the repository at this point in the history
Backport from #171 to branch 3.x
  • Loading branch information
alexdebril authored Jun 18, 2018
2 parents 2e02120 + 1008f35 commit a79a09a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 23 deletions.
16 changes: 8 additions & 8 deletions src/FeedIo/Standard/Rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ public function getMainElement(\DOMDocument $document)
*/
public function buildFeedRuleSet()
{
$ruleSet = $this->buildItemRuleSet();
$ruleSet->add($this->getModifiedSinceRule('lastPubDate'), ['lastBuildDate'])
->add(new Language());
$ruleSet = $this->buildBaseRuleSet();
$ruleSet->add(new Language());

return $ruleSet;
}
Expand All @@ -100,11 +99,8 @@ public function buildItemRuleSet()
$ruleSet = $this->buildBaseRuleSet();
$ruleSet
->add(new Author(), ['dc:creator'])
->add(new Link())
->add(new PublicId())
->add(new Description())
->add(new Media(), ['media:thumbnail'])
->add($this->getModifiedSinceRule(static::DATE_NODE_TAGNAME));
->add(new Media(), ['media:thumbnail']);

return $ruleSet;
}
Expand All @@ -115,7 +111,11 @@ public function buildItemRuleSet()
protected function buildBaseRuleSet()
{
$ruleSet = parent::buildBaseRuleSet();
$ruleSet->add(new Category());
$ruleSet
->add(new Link())
->add(new Description())
->add($this->getModifiedSinceRule(static::DATE_NODE_TAGNAME, ['lastBuildDate', 'lastPubDate']))
->add(new Category());

return $ruleSet;
}
Expand Down
9 changes: 5 additions & 4 deletions tests/FeedIo/StandardFormatter/FormatterTestAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,20 @@ public function testFormat()
$date = new \DateTime('2014/12/01');
$feed = new Feed();
$feed->setTitle('sample title');
$feed->setPublicId('http://localhost/item/1');
$feed->setLastModified($date);
$feed->setLink('http://localhost');
$feed->setPublicId(1);
$feed->setDescription('a sample feed');
$feed->setLanguage('en');
$feed->addCategory($category);

$item = new Item();
$item->setPublicId(42);
$item->setPublicId('http://localhost/item/1');
$item->setLastModified($date);
$item->setTitle('item title');
$item->setDescription('A great description');
$item->setLink('http://localhost/item/1');
$item->set('author', 'name');
$item->set('author', 'name@domain.tld');
$item->addCategory($category);
$feed->add($item);

Expand Down
7 changes: 3 additions & 4 deletions tests/samples/expected-atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
<title>sample title</title>
<category label="sample" scheme="http://localhost" term="sample" />
<link href="http://localhost"/>
<id>1</id>
<id>http://localhost/item/1</id>
<lang>en</lang>
<updated>2014-12-01T00:00:00+00:00</updated>

<entry>
<title>item title</title>
<category label="sample" scheme="http://localhost" term="sample" />
<link href="http://localhost/item/1"/>
<id>42</id>
<id>http://localhost/item/1</id>
<updated>2014-12-01T00:00:00+00:00</updated>
<content>A great description</content>
<author>name</author>
<author>name@domain.tld</author>
</entry>
</feed>
12 changes: 5 additions & 7 deletions tests/samples/rss/expected-rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@
<rss version="2.0">
<channel>
<title>sample title</title>
<category domain="http://localhost">sample</category>
<link>http://localhost</link>
<guid>1</guid>
<description/>
<description>a sample feed</description>
<pubDate>Mon, 01 Dec 2014 00:00:00 +0000</pubDate>
<lastPubDate>Mon, 01 Dec 2014 00:00:00 +0000</lastPubDate>
<category domain="http://localhost">sample</category>
<language>en</language>
<item>
<title>item title</title>
<category domain="http://localhost">sample</category>
<link>http://localhost/item/1</link>
<guid>42</guid>
<description>A great description</description>
<pubDate>Mon, 01 Dec 2014 00:00:00 +0000</pubDate>
<author>name</author>
<category domain="http://localhost">sample</category>
<guid>http://localhost/item/1</guid>
<author>name@domain.tld</author>
</item>
</channel>
</rss>

0 comments on commit a79a09a

Please sign in to comment.