/** * @covers Debril\RssAtomBundle\Protocol\Parser\RssParser::parseBody */ public function testParseWithDublinCoreExtension() { $file = dirname(__FILE__) . '/../../../Resources/sample-rss-creator.xml'; $xmlBody = new \SimpleXMLElement(file_get_contents($file)); $date = \DateTime::createFromFormat('Y-m-d', '2005-10-10'); $filters = array(new ModifiedSince($date)); $feed = $this->object->parse($xmlBody, new FeedContent(), $filters); $this->assertGreaterThan(0, $feed->getItemsCount()); $item = current($feed->getItems()); $this->assertInternalType('string', $item->getAuthor()); $this->assertEquals('John Doe', $item->getAuthor()); }
/** * @covers Debril\RssAtomBundle\Protocol\Parser::guessDateFormat * @dataProvider getDefaultFormats * @expectedException \Debril\RssAtomBundle\Exception\ParserException */ public function testGuessDateFormatException(array $default) { $this->object->setdateFormats($default); $date = '2003-13T18:30:02Z'; $this->object->guessDateFormat($date); }