diff options
Diffstat (limited to 'vendor/fguillot/picofeed/tests/Parser')
7 files changed, 85 insertions, 21 deletions
diff --git a/vendor/fguillot/picofeed/tests/Parser/AtomParserTest.php b/vendor/fguillot/picofeed/tests/Parser/AtomParserTest.php index b94f64b1d..394734ca1 100644 --- a/vendor/fguillot/picofeed/tests/Parser/AtomParserTest.php +++ b/vendor/fguillot/picofeed/tests/Parser/AtomParserTest.php @@ -52,15 +52,38 @@ class AtomParserTest extends PHPUnit_Framework_TestCase { $parser = new Atom(file_get_contents('tests/fixtures/atom.xml')); $feed = $parser->execute(); - $this->assertEquals('http://googleblog.blogspot.com/', $feed->getUrl()); + $this->assertEquals('', $feed->getFeedUrl()); + + $parser = new Atom(file_get_contents('tests/fixtures/atomsample.xml'), '', 'http://example.org/'); + $feed = $parser->execute(); + $this->assertEquals('http://example.org/', $feed->getFeedUrl()); + + $parser = new Atom(file_get_contents('tests/fixtures/lagrange.xml')); + $feed = $parser->execute(); + $this->assertEquals('http://www.la-grange.net/feed.atom', $feed->getFeedUrl()); + + $parser = new Atom(file_get_contents('tests/fixtures/groovehq.xml'), '', 'http://groovehq.com/'); + $feed = $parser->execute(); + $this->assertEquals('http://groovehq.com/articles.xml', $feed->getFeedUrl()); + } + + public function testSiteUrl() + { + $parser = new Atom(file_get_contents('tests/fixtures/atom.xml')); + $feed = $parser->execute(); + $this->assertEquals('http://googleblog.blogspot.com/', $feed->getSiteUrl()); $parser = new Atom(file_get_contents('tests/fixtures/atomsample.xml')); $feed = $parser->execute(); - $this->assertEquals('http://example.org/', $feed->getUrl()); + $this->assertEquals('http://example.org/', $feed->getSiteUrl()); $parser = new Atom(file_get_contents('tests/fixtures/lagrange.xml')); $feed = $parser->execute(); - $this->assertEquals('http://www.la-grange.net/', $feed->getUrl()); + $this->assertEquals('http://www.la-grange.net/', $feed->getSiteUrl()); + + $parser = new Atom(file_get_contents('tests/fixtures/groovehq.xml')); + $feed = $parser->execute(); + $this->assertEquals('', $feed->getSiteUrl()); } public function testFeedId() diff --git a/vendor/fguillot/picofeed/tests/Parser/ItemTest.php b/vendor/fguillot/picofeed/tests/Parser/ItemTest.php new file mode 100644 index 000000000..5254acc9a --- /dev/null +++ b/vendor/fguillot/picofeed/tests/Parser/ItemTest.php @@ -0,0 +1,24 @@ +<?php + +namespace PicoFeed\Parser; + +use PHPUnit_Framework_TestCase; + +class ItemTest extends PHPUnit_Framework_TestCase +{ + public function testLangRTL() + { + $item = new Item; + $item->language = 'fr_FR'; + $this->assertFalse($item->isRTL()); + + $item->language = 'ur'; + $this->assertTrue($item->isRTL()); + + $item->language = 'syr-**'; + $this->assertTrue($item->isRTL()); + + $item->language = 'ru'; + $this->assertFalse($item->isRTL()); + } +} diff --git a/vendor/fguillot/picofeed/tests/Parser/ParserTest.php b/vendor/fguillot/picofeed/tests/Parser/ParserTest.php index 3be864507..449e0c9ce 100644 --- a/vendor/fguillot/picofeed/tests/Parser/ParserTest.php +++ b/vendor/fguillot/picofeed/tests/Parser/ParserTest.php @@ -1,9 +1,9 @@ <?php + namespace PicoFeed\Parser; use PHPUnit_Framework_TestCase; - class ParserTest extends PHPUnit_Framework_TestCase { public function testParseDate() @@ -22,6 +22,7 @@ class ParserTest extends PHPUnit_Framework_TestCase $this->assertEquals(1364234797, $parser->parseDate('Mon, 25 Mar 2013 19:06:37 +0100')); $this->assertEquals(1360054941, $parser->parseDate('2013-02-05T09:02:21.880-08:00')); $this->assertEquals(1286834400, $parser->parseDate('Tue, 12 Oct 2010 00:00:00 IST')); + $this->assertEquals('2014-12-15 19:49', date('Y-m-d H:i', $parser->parseDate('15 Dec 2014 19:49:07 +0100'))); $this->assertEquals('2012-05-15', date('Y-m-d', $parser->parseDate('Tue, 15 May 2012 24:05:00 UTC'))); $this->assertEquals('2013-09-12', date('Y-m-d', $parser->parseDate('Thu, 12 Sep 2013 7:00:00 UTC'))); $this->assertEquals('2012-01-31', date('Y-m-d', $parser->parseDate('01.31.2012'))); @@ -54,14 +55,6 @@ class ParserTest extends PHPUnit_Framework_TestCase $this->assertEquals('da23614e02469a0d7c7bd1bdab5c9c474b1904dc', $parser->generateId('a', 'b')); } - public function testLangRTL() - { - $this->assertFalse(Parser::isLanguageRTL('fr-FR')); - $this->assertTrue(Parser::isLanguageRTL('ur')); - $this->assertTrue(Parser::isLanguageRTL('syr-**')); - $this->assertFalse(Parser::isLanguageRTL('ru')); - } - public function testNamespaceValue() { $xml = XmlParser::getSimpleXml(file_get_contents('tests/fixtures/rue89.xml')); diff --git a/vendor/fguillot/picofeed/tests/Parser/Rss10ParserTest.php b/vendor/fguillot/picofeed/tests/Parser/Rss10ParserTest.php index bc0824502..f06ff3544 100644 --- a/vendor/fguillot/picofeed/tests/Parser/Rss10ParserTest.php +++ b/vendor/fguillot/picofeed/tests/Parser/Rss10ParserTest.php @@ -26,14 +26,21 @@ class Rss10ParserTest extends PHPUnit_Framework_TestCase { $parser = new Rss10(file_get_contents('tests/fixtures/planete-jquery.xml')); $feed = $parser->execute(); - $this->assertEquals('http://planete-jquery.fr', $feed->getUrl()); + $this->assertEquals('', $feed->getFeedUrl()); + } + + public function testSiteUrl() + { + $parser = new Rss10(file_get_contents('tests/fixtures/planete-jquery.xml')); + $feed = $parser->execute(); + $this->assertEquals('http://planete-jquery.fr/', $feed->getSiteUrl()); } public function testFeedId() { $parser = new Rss10(file_get_contents('tests/fixtures/planete-jquery.xml')); $feed = $parser->execute(); - $this->assertEquals('http://planete-jquery.fr', $feed->getId()); + $this->assertEquals('http://planete-jquery.fr/', $feed->getId()); } public function testFeedDate() diff --git a/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php b/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php index b06821c27..c282ad372 100644 --- a/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php +++ b/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php @@ -56,11 +56,26 @@ class Rss20ParserTest extends PHPUnit_Framework_TestCase { $parser = new Rss20(file_get_contents('tests/fixtures/rss20.xml')); $feed = $parser->execute(); - $this->assertEquals('http://wordpress.org/news', $feed->getUrl()); + $this->assertEquals('', $feed->getFeedUrl()); + + $parser = new Rss20(file_get_contents('tests/fixtures/rss20.xml'), '', 'http://example.com/feed'); + $feed = $parser->execute(); + $this->assertEquals('http://example.com/feed', $feed->getFeedUrl()); + + $parser = new Rss20(file_get_contents('tests/fixtures/pcinpact.xml')); + $feed = $parser->execute(); + $this->assertEquals('', $feed->getFeedUrl()); + } + + public function testSiteUrl() + { + $parser = new Rss20(file_get_contents('tests/fixtures/rss20.xml')); + $feed = $parser->execute(); + $this->assertEquals('http://wordpress.org/news', $feed->getSiteUrl()); $parser = new Rss20(file_get_contents('tests/fixtures/pcinpact.xml')); $feed = $parser->execute(); - $this->assertEquals('http://www.pcinpact.com/', $feed->getUrl()); + $this->assertEquals('http://www.pcinpact.com/', $feed->getSiteUrl()); } public function testFeedId() @@ -231,7 +246,7 @@ class Rss20ParserTest extends PHPUnit_Framework_TestCase $parser = new Rss20(file_get_contents('tests/fixtures/geekstammtisch.de_episodes.mp3.rss')); $feed = $parser->execute(); $this->assertNotEmpty($feed->items); - $this->assertEquals('http://geekstammtisch.de#GST001', $feed->items[1]->getUrl()); + $this->assertEquals('http://geekstammtisch.de/#GST001', $feed->items[1]->getUrl()); $parser = new Rss20(file_get_contents('tests/fixtures/lincoln_loop.xml')); $feed = $parser->execute(); diff --git a/vendor/fguillot/picofeed/tests/Parser/Rss91ParserTest.php b/vendor/fguillot/picofeed/tests/Parser/Rss91ParserTest.php index 8f10f2ea5..f84a0d0d0 100644 --- a/vendor/fguillot/picofeed/tests/Parser/Rss91ParserTest.php +++ b/vendor/fguillot/picofeed/tests/Parser/Rss91ParserTest.php @@ -15,8 +15,9 @@ class Rss91ParserTest extends PHPUnit_Framework_TestCase $this->assertNotEmpty($feed->items); $this->assertEquals('WriteTheWeb', $feed->getTitle()); - $this->assertEquals('http://writetheweb.com', $feed->getUrl()); - $this->assertEquals('http://writetheweb.com', $feed->getId()); + $this->assertEquals('', $feed->getFeedUrl()); + $this->assertEquals('http://writetheweb.com/', $feed->getSiteUrl()); + $this->assertEquals('http://writetheweb.com/', $feed->getId()); $this->assertEquals(time(), $feed->getDate()); $this->assertEquals(6, count($feed->items)); diff --git a/vendor/fguillot/picofeed/tests/Parser/Rss92ParserTest.php b/vendor/fguillot/picofeed/tests/Parser/Rss92ParserTest.php index 1d67c2252..521cd7b05 100644 --- a/vendor/fguillot/picofeed/tests/Parser/Rss92ParserTest.php +++ b/vendor/fguillot/picofeed/tests/Parser/Rss92ParserTest.php @@ -15,8 +15,9 @@ class Rss92ParserTest extends PHPUnit_Framework_TestCase $this->assertNotEmpty($feed->items); $this->assertEquals('Univers Freebox', $feed->getTitle()); - $this->assertEquals('http://www.universfreebox.com', $feed->getUrl()); - $this->assertEquals('http://www.universfreebox.com', $feed->getId()); + $this->assertEquals('', $feed->getFeedUrl()); + $this->assertEquals('http://www.universfreebox.com/', $feed->getSiteUrl()); + $this->assertEquals('http://www.universfreebox.com/', $feed->getId()); $this->assertEquals(time(), $feed->date); $this->assertEquals(30, count($feed->items)); |