Skip to content

Commit

Permalink
Add Author rules to standards
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdebril committed May 2, 2017
1 parent aa37e24 commit 085764d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
9 changes: 6 additions & 3 deletions src/FeedIo/Standard/Atom.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace FeedIo\Standard;

use DOMDocument;
use FeedIo\Rule\Atom\Author;
use FeedIo\Rule\Atom\LinkNode;
use FeedIo\Rule\Description;
use FeedIo\Rule\PublicId;
Expand Down Expand Up @@ -82,11 +83,13 @@ public function buildFeedRuleSet()
public function buildItemRuleSet()
{
$ruleSet = $this->buildFeedRuleSet();
$ruleSet->add(new Description('content'), ['summary']);
$ruleSet
->add(new Author())
->add(new Description('content'), ['summary']);

return $ruleSet;
}
}

/**
* @return RuleSet
*/
Expand Down
8 changes: 5 additions & 3 deletions src/FeedIo/Standard/Rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace FeedIo\Standard;

use DOMDocument;
use FeedIo\Rule\Author;
use FeedIo\Rule\Description;
use FeedIo\Rule\Link;
use FeedIo\Rule\PublicId;
Expand Down Expand Up @@ -97,15 +98,16 @@ public function buildItemRuleSet()
{
$ruleSet = $this->buildBaseRuleSet();
$ruleSet
->add(new Author())
->add(new Link())
->add(new PublicId())
->add(new Description())
->add(new Media())
->add($this->getModifiedSinceRule(static::DATE_NODE_TAGNAME));

return $ruleSet;
}
}

/**
* @return RuleSet
*/
Expand All @@ -116,5 +118,5 @@ protected function buildBaseRuleSet()

return $ruleSet;
}

}
6 changes: 3 additions & 3 deletions tests/FeedIo/Parser/ParserTestAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function testParseBody()
$this->assertNotEmpty($item->getLastModified());
$this->assertNotEmpty($item->getLink());
$this->assertCount(1, $item->getAllElements());
$this->assertTrue($item->hasElement('author'));
$this->assertTrue($item->hasElement('extra'));
$this->runCategoriesTest($item);
}
}
Expand All @@ -86,10 +86,10 @@ protected function runCategoriesTest(\FeedIo\Feed\NodeInterface $node)
{
$categories = $node->getCategories();
$this->assertCount(1, $categories);

$category = $categories->current();
$this->assertInstanceOf('\FeedIo\Feed\Node\CategoryInterface', $category);

$this->assertNotEmpty($category->getTerm());
$this->assertNotEmpty($category->getLabel());
}
Expand Down

0 comments on commit 085764d

Please sign in to comment.