Skip to content

Commit

Permalink
Merge pull request #90 from alexdebril/issue/66
Browse files Browse the repository at this point in the history
Fix #66
  • Loading branch information
alexdebril authored Jun 3, 2017
2 parents 19deb31 + c044c36 commit 8c529b9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/FeedIo/Standard/Rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class Rss extends StandardAbstract
*/
const DATE_NODE_TAGNAME = 'pubDate';

protected $mandatoryFields = ['channel'];

/**
* Formats the document according to the standard's specification
* @param \DOMDocument $document
Expand Down
19 changes: 18 additions & 1 deletion tests/FeedIo/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@

use FeedIo\Feed\Item;
use FeedIo\Rule\DateTimeBuilder;
use FeedIo\Standard\Rss;
use Psr\Log\NullLogger;

class ParserTest extends \PHPUnit_Framework_TestCase
{

/**
* @var \FeedIo\ParserAbstract
* @var \FeedIo\Parser
*/
protected $object;

Expand Down Expand Up @@ -150,6 +151,22 @@ public function testAddResetFilters()
$this->assertAttributeCount(0, 'filters', $this->object);
}

/**
* @expectedException \FeedIo\Parser\MissingFieldsException
*/
public function testParseEmptyRssFeed()
{
$rss = <<<RSS
<rss version="2.0"></rss>
RSS;
$document = new \DOMDocument();
$document->loadXML($rss);
$parser = new Parser(new Rss(
new DateTimeBuilder()
), new NullLogger());
$parser->parse($document, new Feed());
}

/**
* @param boolean $returnValue
* @return \FeedIo\FilterInterface
Expand Down

0 comments on commit 8c529b9

Please sign in to comment.