summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/tests/Reader
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/fguillot/picofeed/tests/Reader')
-rw-r--r--vendor/fguillot/picofeed/tests/Reader/FaviconTest.php188
-rw-r--r--vendor/fguillot/picofeed/tests/Reader/ReaderTest.php269
2 files changed, 0 insertions, 457 deletions
diff --git a/vendor/fguillot/picofeed/tests/Reader/FaviconTest.php b/vendor/fguillot/picofeed/tests/Reader/FaviconTest.php
deleted file mode 100644
index e278503c4..000000000
--- a/vendor/fguillot/picofeed/tests/Reader/FaviconTest.php
+++ /dev/null
@@ -1,188 +0,0 @@
-<?php
-
-namespace PicoFeed\Reader;
-
-use PHPUnit_Framework_TestCase;
-use PicoFeed\Client\Url;
-
-class FaviconTest extends PHPUnit_Framework_TestCase
-{
- public function testExtract()
- {
- $favicon = new Favicon;
-
- $html = '<!DOCTYPE html><html><head>
- <link rel="icon" href="http://example.com/myicon.ico" />
- </head><body><p>boo</p></body></html>';
-
- $this->assertEquals(array('http://example.com/myicon.ico'), $favicon->extract($html));
-
- // multiple values in rel attribute
- $html = '<!DOCTYPE html><html><head>
- <link rel="shortcut icon" href="http://example.com/myicon.ico" />
- </head><body><p>boo</p></body></html>';
-
- $this->assertEquals(array('http://example.com/myicon.ico'), $favicon->extract($html));
-
- // icon part of another string
- $html = '<!DOCTYPE html><html><head>
- <link rel="fluid-icon" href="http://example.com/myicon.ico" />
- </head><body><p>boo</p></body></html>';
-
- $this->assertEquals(array('http://example.com/myicon.ico'), $favicon->extract($html));
-
- // with other attributes present
- $html = '<!DOCTYPE html><html><head>
- <link rel="icon" type="image/vnd.microsoft.icon" href="http://example.com/image.ico" />
- </head><body><p>boo</p></body></html>';
-
- $this->assertEquals(array('http://example.com/image.ico'), $favicon->extract($html));
-
- // ignore icon in other attribute
- $html = '<!DOCTYPE html><html><head>
- <link type="icon" href="http://example.com/image.ico" />
- </head><body><p>boo</p></body></html>';
-
- // ignores apple icon
- $html = '<!DOCTYPE html><html><head>
- <link rel="apple-touch-icon" href="assets/img/touch-icon-iphone.png">
- <link rel="icon" type="image/png" href="http://example.com/image.png" />
- </head><body><p>boo</p></body></html>';
-
- $this->assertEquals(array('http://example.com/image.png'), $favicon->extract($html));
-
- // allows multiple icons
- $html = '<!DOCTYPE html><html><head>
- <link rel="icon" type="image/png" href="http://example.com/image.png" />
- <link rel="icon" type="image/x-icon" href="http://example.com/image.ico"/>
- </head><body><p>boo</p></body></html>';
-
- $this->assertEquals(array('http://example.com/image.png', 'http://example.com/image.ico'), $favicon->extract($html));
-
- // empty array with broken html
- $html = '!DOCTYPE html html head
- link rel="icon" type="image/png" href="http://example.com/image.png" /
- link rel="icon" type="image/x-icon" href="http://example.com/image.ico"/
- /head body /p boo /p body /html';
-
- $this->assertEquals(array(), $favicon->extract($html));
-
- // empty array on no input
- $this->assertEquals(array(), $favicon->extract(''));
-
- // empty array on no icon found
- $html = '<!DOCTYPE html><html><head>
- </head><body><p>boo</p></body></html>';
-
- $this->assertEquals(array(), $favicon->extract($html));
- }
-
- /**
- * @group online
- */
- public function testExists()
- {
- $favicon = new Favicon;
-
- $this->assertTrue($favicon->exists('https://miniflux.net/favicon.ico'));
- $this->assertFalse($favicon->exists('http://minicoders.com/favicon.ico'));
- $this->assertFalse($favicon->exists('http://blabla'));
- $this->assertFalse($favicon->exists(''));
- }
-
- /**
- * @group online
- */
- public function testFind_inMeta()
- {
- $favicon = new Favicon;
-
- // favicon in meta
- $this->assertEquals(
- 'http://miniflux.net/assets/img/favicon.png',
- $favicon->find('http://miniflux.net')
- );
-
- $this->assertNotEmpty($favicon->getContent());
- }
-
-// public function testFind_inRootDir()
-// {
-// // favicon not in meta, only in website root (need example page)
-// $favicon = new Favicon;
-//
-// $this->assertEquals(
-// 'http://minicoders.com/favicon.ico',
-// $favicon->find('http://minicoders.com')
-// );
-// }
-
- public function testFind_noIcons()
- {
- $favicon = new Favicon;
-
- $this->assertEquals(
- '',
- $favicon->find('http://minicoders.com')
- );
-
- $this->assertEmpty($favicon->getContent());
- }
-
- /**
- * @group online
- */
- public function testFind_directLinkFirst()
- {
- $favicon = new Favicon;
-
- $this->assertEquals(
- 'http://miniflux.net/assets/img/touch-icon-ipad.png',
- $favicon->find('http://miniflux.net', '/assets/img/touch-icon-ipad.png')
- );
-
- $this->assertNotEmpty($favicon->getContent());
- }
-
- /**
- * @group online
- */
- public function testFind_fallsBackToExtract()
- {
- $favicon = new Favicon;
- $this->assertEquals(
- 'http://miniflux.net/assets/img/favicon.png',
- $favicon->find('http://miniflux.net','/nofavicon.ico')
- );
-
- $this->assertNotEmpty($favicon->getContent());
- }
-
- /**
- * @group online
- */
- public function testDataUri()
- {
- $favicon = new Favicon;
-
- $this->assertEquals(
- 'http://miniflux.net/assets/img/favicon.png',
- $favicon->find('http://miniflux.net')
- );
-
- $expected = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAGJwAABicBTVTYxwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAALMSURBVHic7Zo7a1RRFIW/I8YXaBBEJRJEU8RqQBBBQRBEWxHBwlZUsLRWUFBsA4L4G4IY0TaF2PhEEQwmhuADJIkRUUOMr2RZ3Em8mcxkzrkPtjhnwS7msveadT/Ofc44SbSyllkHsFYEYB3AWhGAdQBrRQDWAawVAVgHsFYEYB3AWhGAdQBrLS/L2Dm3CdgFbK3WDPC6Wi8kjWX03QBUgG3AdmAN8LFaT4CnCnjEdbW9zrk+YL3n/AVJd2vmDwKngMNAW4O538BNoEfSfa+gzu0DzgBHl/AFGAN6gcuSPjQ1lrSggHFAnnUsNdcO3AiYnas7wNraHCnfLcC9DL6TwNlGvvP+RQAAdgIjGULO1XOgs06WQ8BEDl8BPVRXeikAgK4CQgp4B7SnchwnOW/k9RVwviwAp4HBgkIKuJ5aUd8K9P0JVMoA8LnAkAJmgSPA24J9BfTXA1DvKjAObOT/k4BuScPpjWXcCM0Co8CnErynSFbHTIZZB5xYtDXnIZCuCeAkqUsa0AlcyeiXrtvAnpTvamA/8CbQ50HR54C5egV0LHEtv5hj588t4dsBvA/wmgbaigbwneTYanyzkayELDvf2/RGBi4FelaKBnC1Wciq70Cg7y+gy8O3O9D3QHq+iJPgNc++R4G+/ZJGPPqGSU68vlqX/pAXwKCkl569XwK9b/k0SZoleRL0VaEAngX0TgZ6Pw7obf7U91cr0x/yAhgK6A0BIMB3ZUFyq5tJeQGELL2vAb1TkqYD+lcF9C5QXgAhO/WjJF/I8WYrL4CQnfoXfBep5V+KRgDWAawVAVgHsFYEYB3AWhGAdQBrRQDWAawVAVgHsFYEYB3AWi0PoN6Po3uBFZ7zA5ImvL7Iuc3ADk/faUkPPXtxzu0m+a+Qj4Ykjc7P1gJoNbX8IRABWAewVgRgHcBaEYB1AGtFANYBrBUBWAewVssD+AMBy6wzsaDiAwAAAABJRU5ErkJggg==';
-
- $this->assertEquals($expected, $favicon->getDataUri());
- }
-
- /**
- * @group online
- */
- public function testDataUri_withBadContentType()
- {
- $favicon = new Favicon;
- $this->assertNotEmpty($favicon->find('http://www.lemonde.fr/'));
- $expected = 'data:image/x-icon;base64,AAABAAIAICAAAAEACACoCAAAJgAAABAQEAABAAQAKAEAAM4IAAAoAAAAIAAAAEAAAAABAAgAAAAAAAAEAAASCwAAEgsAAAABAAAAAQAAAAAAAAEBAQACAgIAAwMDAAQEBAAFBQUABgYGAAcHBwAICAgACQkJAAoKCgALCwsADAwMAA0NDQAODg4ADw8PABAQEAAREREAEhISABMTEwAUFBQAFRUVABYWFgAXFxcAGBgYABkZGQAaGhoAGxsbABwcHAAdHR0AHh4eAB8fHwAgICAAISEhACIiIgAjIyMAJCQkACUlJQAmJiYAJycnACgoKAApKSkAKioqACsrKwAsLCwALS0tAC4uLgAvLy8AMDAwADExMQAyMjIAMzMzADQ0NAA1NTUANjY2ADc3NwA4ODgAOTk5ADo6OgA7OzsA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAABILAAASCwAAEAAAABAAAAAAAAAAEhISACIiIgAyMjIAQkJCAFJSUgBiYmIAcnJyAIKCggCOjo4Anp6eAK6urgDOzs4A3t7eAO7u7gD+/v4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGBKI5IaYAAAbf/p/0/7AAABfCT/T/AAAABPxP9P8AAAAE/0/0/wAAAAT/T/T/AAAABP9P9P8AAAEk/1/x3xAACP//7+7/wQABt7k6JKIQAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
- $this->assertEquals($expected, $favicon->getDataUri());
- }
-}
diff --git a/vendor/fguillot/picofeed/tests/Reader/ReaderTest.php b/vendor/fguillot/picofeed/tests/Reader/ReaderTest.php
deleted file mode 100644
index c3c93fc8c..000000000
--- a/vendor/fguillot/picofeed/tests/Reader/ReaderTest.php
+++ /dev/null
@@ -1,269 +0,0 @@
-<?php
-
-namespace PicoFeed\Reader;
-
-use PHPUnit_Framework_TestCase;
-
-class ReaderTest extends PHPUnit_Framework_TestCase
-{
- public function testPrependScheme()
- {
- $reader = new Reader;
- $this->assertEquals('http://http.com', $reader->prependScheme('http.com'));
- $this->assertEquals('http://boo.com', $reader->prependScheme('boo.com'));
- $this->assertEquals('http://google.com', $reader->prependScheme('http://google.com'));
- $this->assertEquals('https://google.com', $reader->prependScheme('https://google.com'));
- }
-
- /**
- * @group online
- */
- public function testDownloadHTTP()
- {
- $reader = new Reader;
- $feed = $reader->download('http://wordpress.org/news/feed/')->getContent();
- $this->assertNotEmpty($feed);
- }
-
- /**
- * @group online
- */
- public function testDownloadHTTPS()
- {
- $reader = new Reader;
- $feed = $reader->download('https://wordpress.org/news/feed/')->getContent();
- $this->assertNotEmpty($feed);
- }
-
- /**
- * @group online
- */
- public function testDownloadCache()
- {
- $reader = new Reader;
- $resource = $reader->download('http://linuxfr.org/robots.txt');
- $this->assertTrue($resource->isModified());
-
- $lastModified = $resource->getLastModified();
- $etag = $resource->getEtag();
-
- $reader = new Reader;
- $resource = $reader->download('http://linuxfr.org/robots.txt', $lastModified, $etag);
- $this->assertFalse($resource->isModified());
- }
-
- public function testDetectFormat()
- {
- $reader = new Reader;
- $this->assertEquals('Rss20', $reader->detectFormat(file_get_contents('tests/fixtures/podbean.xml')));
-
- $reader = new Reader;
- $this->assertEquals('Rss20', $reader->detectFormat(file_get_contents('tests/fixtures/jeux-linux.fr.xml')));
-
- $reader = new Reader;
- $this->assertEquals('Rss20', $reader->detectFormat(file_get_contents('tests/fixtures/sametmax.xml')));
-
- $reader = new Reader;
- $this->assertEquals('Rss92', $reader->detectFormat(file_get_contents('tests/fixtures/rss_0.92.xml')));
-
- $reader = new Reader;
- $this->assertEquals('Rss91', $reader->detectFormat(file_get_contents('tests/fixtures/rss_0.91.xml')));
-
- $reader = new Reader;
- $this->assertEquals('Rss10', $reader->detectFormat(file_get_contents('tests/fixtures/planete-jquery.xml')));
-
- $reader = new Reader;
- $this->assertEquals('Rss20', $reader->detectFormat(file_get_contents('tests/fixtures/rss2sample.xml')));
-
- $reader = new Reader;
- $this->assertEquals('Atom', $reader->detectFormat(file_get_contents('tests/fixtures/atomsample.xml')));
-
- $reader = new Reader;
- $this->assertEquals('Rss20', $reader->detectFormat(file_get_contents('tests/fixtures/cercle.psy.xml')));
-
- $reader = new Reader;
- $this->assertEquals('Rss20', $reader->detectFormat(file_get_contents('tests/fixtures/ezrss.it')));
-
- $content = '<?xml version="1.0" encoding="UTF-8"?>
-<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2titles.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemtitles.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">';
-
- $reader = new Reader;
- $this->assertEquals('Rss20', $reader->detectFormat($content));
- }
-
- public function testFindRssFeed()
- {
- $reader = new Reader;
-
- $html = '<!DOCTYPE html><html><head>
- <link type="application/rss+xml" href="http://miniflux.net/feed">
- </head><body><p>boo</p></body></html>';
-
- $feeds = $reader->find('http://miniflux.net/', $html);
- $this->assertEquals(array('http://miniflux.net/feed'), $feeds);
- }
-
- public function testFindAtomFeed()
- {
- $reader = new Reader;
-
- $html = '<!DOCTYPE html><html><head>
- <link type="application/atom+xml" href="http://miniflux.net/feed">
- </head><body><p>boo</p></body></html>';
-
- $feeds = $reader->find('http://miniflux.net/', $html);
- $this->assertEquals(array('http://miniflux.net/feed'), $feeds);
- }
-
- public function testFindFeedNotInHead()
- {
- $reader = new Reader;
-
- $html = '<!DOCTYPE html><html><head></head>
- <body>
- <link type="application/atom+xml" href="http://miniflux.net/feed">
- <p>boo</p></body></html>';
-
- $feeds = $reader->find('http://miniflux.net/', $html);
- $this->assertEquals(array('http://miniflux.net/feed'), $feeds);
- }
-
- public function testFindNoFeedPresent()
- {
- $reader = new Reader;
-
- $html = '<!DOCTYPE html><html><head>
- </head><body><p>boo</p></body></html>';
-
- $feeds = $reader->find('http://miniflux.net/', $html);
- $this->assertEquals(array(), $feeds);
- }
-
- public function testFindIgnoreUnknownType()
- {
- $reader = new Reader;
-
- $html = '<!DOCTYPE html><html><head>
- <link type="application/flux+xml" href="http://miniflux.net/feed">
- </head><body><p>boo</p></body></html>';
-
- $feeds = $reader->find('http://miniflux.net/', $html);
- $this->assertEquals(array(), $feeds);
- }
-
- public function testFindIgnoreTypeInOtherAttribute()
- {
- $reader = new Reader;
-
- $html = '<!DOCTYPE html><html><head>
- <link rel="application/rss+xml" href="http://miniflux.net/feed">
- </head><body><p>boo</p></body></html>';
-
- $feeds = $reader->find('http://miniflux.net/', $html);
- $this->assertEquals(array(), $feeds);
- }
-
- public function testFindWithOtherAttributesPresent()
- {
- $reader = new Reader;
-
- $html = '<!DOCTYPE html><html><head>
- <link rel="alternate" type="application/rss+xml" title="RSS" href="http://miniflux.net/feed">
- </head><body><p>boo</p></body></html>';
-
- $feeds = $reader->find('http://miniflux.net/', $html);
- $this->assertEquals(array('http://miniflux.net/feed'), $feeds);
- }
-
- public function testFindMultipleFeeds()
- {
- $reader = new Reader;
-
- $html = '<!DOCTYPE html><html><head>
- <link rel="alternate" type="application/rss+xml" title="CNN International: Top Stories" href="http://rss.cnn.com/rss/edition.rss"/>
- <link rel="alternate" type="application/rss+xml" title="Connect The World" href="http://rss.cnn.com/rss/edition_connecttheworld.rss"/>
- <link rel="alternate" type="application/rss+xml" title="World Sport" href="http://rss.cnn.com/rss/edition_worldsportblog.rss"/>
- </head><body><p>boo</p></body></html>';
-
- $feeds = $reader->find('http://www.cnn.com/services/rss/', $html);
- $this->assertEquals(
- array(
- 'http://rss.cnn.com/rss/edition.rss',
- 'http://rss.cnn.com/rss/edition_connecttheworld.rss',
- 'http://rss.cnn.com/rss/edition_worldsportblog.rss'
- ),
- $feeds
- );
- }
-
- public function testFindWithInvalidHTML()
- {
- $reader = new Reader;
-
- $html = '!DOCTYPE html html head
- link type="application/rss+xml" href="http://miniflux.net/feed"
- /head body /p boo /p body /html';
-
- $feeds = $reader->find('http://miniflux.net/', '');
- $this->assertEquals(array(), $feeds);
- }
-
- public function testFindWithHtmlParamEmptyString()
- {
- $reader = new Reader;
-
- $feeds = $reader->find('http://miniflux.net/', '');
- $this->assertEquals(array(), $feeds);
- }
-
- /**
- * @group online
- */
- public function testDiscover()
- {
- $reader = new Reader;
- $client = $reader->discover('http://www.universfreebox.com/');
- $this->assertEquals('http://www.universfreebox.com/backend.php', $client->getUrl());
- $this->assertInstanceOf('PicoFeed\Parser\Rss20', $reader->getParser($client->getUrl(), $client->getContent(), $client->getEncoding()));
-
- $reader = new Reader;
- $client = $reader->discover('http://planete-jquery.fr');
- $this->assertInstanceOf('PicoFeed\Parser\Rss10', $reader->getParser($client->getUrl(), $client->getContent(), $client->getEncoding()));
-
- $reader = new Reader;
- $client = $reader->discover('http://cabinporn.com/');
- $this->assertEquals('http://cabinporn.com/rss', $client->getUrl());
- $this->assertInstanceOf('PicoFeed\Parser\Rss20', $reader->getParser($client->getUrl(), $client->getContent(), $client->getEncoding()));
-
- $reader = new Reader;
- $client = $reader->discover('http://linuxfr.org/');
- $this->assertEquals('http://linuxfr.org/news.atom', $client->getUrl());
- $this->assertInstanceOf('PicoFeed\Parser\Atom', $reader->getParser($client->getUrl(), $client->getContent(), $client->getEncoding()));
- }
-
- public function testGetParserUsesHTTPEncoding()
- {
- $reader = new Reader;
- $parser = $reader->getParser('http://blah', file_get_contents('tests/fixtures/cercle.psy.xml'), 'iso-8859-1');
- $feed = $parser->execute();
- $this->assertInstanceOf('PicoFeed\Parser\Rss20', $parser);
- $this->assertNotEmpty($feed->items);
-
- }
-
- public function testGetParserUsesSiteURL()
- {
- $reader = new Reader;
- $parser = $reader->getParser('http://groovehq.com/', file_get_contents('tests/fixtures/groovehq.xml'), '');
- $feed = $parser->execute();
- $this->assertEquals('http://groovehq.com/articles.xml', $feed->getFeedUrl());
- }
-
- public function testFeedsReportedAsNotWorking()
- {
- $reader = new Reader;
- $parser = $reader->getParser('http://blah', file_get_contents('tests/fixtures/ezrss.it'), '');
- $feed = $parser->execute();
- $this->assertNotEmpty($feed->items);
- }
-}