summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/tests
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-01-27 09:31:40 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2015-01-27 09:31:40 +0100
commit8241180c6ce0cb19255d70a3394f891e08182542 (patch)
tree325996a06d9896567957871cc0f34865c46118da /vendor/fguillot/picofeed/tests
parent73f65c8fbadbdd2098448e77b6d3f0464ad8613e (diff)
dont use picofeed submodule
Diffstat (limited to 'vendor/fguillot/picofeed/tests')
m---------vendor/fguillot/picofeed0
-rw-r--r--vendor/fguillot/picofeed/tests/Client/ClientTest.php110
-rw-r--r--vendor/fguillot/picofeed/tests/Client/CurlTest.php54
-rw-r--r--vendor/fguillot/picofeed/tests/Client/GrabberTest.php67
-rw-r--r--vendor/fguillot/picofeed/tests/Client/HttpHeadersTest.php19
-rw-r--r--vendor/fguillot/picofeed/tests/Client/StreamTest.php65
-rw-r--r--vendor/fguillot/picofeed/tests/Client/UrlTest.php292
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/AttributeFilterTest.php175
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/FilterTest.php141
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php168
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/TagFilterTest.php33
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/AtomParserTest.php253
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/DateParserTest.php48
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/FeedTest.php24
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/ItemTest.php24
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/ParserTest.php36
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/Rss10ParserTest.php119
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php267
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/Rss91ParserTest.php31
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/Rss92ParserTest.php29
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/XmlParserTest.php105
-rw-r--r--vendor/fguillot/picofeed/tests/Reader/FaviconTest.php170
-rw-r--r--vendor/fguillot/picofeed/tests/Reader/ReaderTest.php246
-rw-r--r--vendor/fguillot/picofeed/tests/Serialization/ExportTest.php70
-rw-r--r--vendor/fguillot/picofeed/tests/Serialization/ImportTest.php61
-rw-r--r--vendor/fguillot/picofeed/tests/Syndication/AtomWriterTest.php90
-rw-r--r--vendor/fguillot/picofeed/tests/Syndication/Rss20WriterTest.php85
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/atom.xml477
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/atomsample.xml20
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/bbc_urdu.xml2087
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/biertaucher.xml7198
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/cercle.psy.xml58
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/debug_show.xml1073
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/ezrss.it496
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/fanboys.fm_episodes.all.mp3.rss10426
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/fulltextrss.xml88
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/geekstammtisch.de_episodes.mp3.rss9428
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/google-reader.opml78
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/groovehq.xml1767
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/grotte_barbu.xml396
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/hamakor.xml527
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/html4_head_stripped_page.html435
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/html4_page.html486
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/html_head_stripped_page.html804
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/html_page.html967
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/ibash.ru.xml359
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/jeux-linux.fr.xml924
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/lagrange.xml1986
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/lincoln_loop.xml1150
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/newsbeuter.opml43
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/next_inpact_full.xml2435
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/pcinpact.xml1
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/planete-jquery.xml443
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/podbean.xml1596
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/radio-france.xml946
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/resorts.xml169
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/rss20.xml300
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/rss2sample.xml41
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/rss_0.91.xml50
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/rss_0.92.xml103
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/rue89.xml2
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/sametmax.xml1067
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/subscriptionList.opml1
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/tinytinyrss.opml13
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/univers_freebox.xml30
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/womensweardaily.xml63
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/xakep.ru.xml245
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/youtube.xml979
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/zoot_egkty.xml177
69 files changed, 52716 insertions, 0 deletions
diff --git a/vendor/fguillot/picofeed b/vendor/fguillot/picofeed
deleted file mode 160000
-Subproject 0a1d0d3950f7f047dc8fb1d80aa6296e15f306d
diff --git a/vendor/fguillot/picofeed/tests/Client/ClientTest.php b/vendor/fguillot/picofeed/tests/Client/ClientTest.php
new file mode 100644
index 000000000..3f094d04c
--- /dev/null
+++ b/vendor/fguillot/picofeed/tests/Client/ClientTest.php
@@ -0,0 +1,110 @@
+<?php
+
+namespace PicoFeed\Client;
+
+use PHPUnit_Framework_TestCase;
+
+class ClientTest extends PHPUnit_Framework_TestCase
+{
+ public function testDownload()
+ {
+ $client = Client::getInstance();
+ $client->setUrl('http://php.net/robots.txt');
+ $client->execute();
+
+ $this->assertTrue($client->isModified());
+ $this->assertNotEmpty($client->getContent());
+ $this->assertNotEmpty($client->getEtag());
+ $this->assertNotEmpty($client->getLastModified());
+ }
+
+ public function testCacheBothHaveToMatch()
+ {
+ $client = Client::getInstance();
+ $client->setUrl('http://php.net/robots.txt');
+ $client->execute();
+ $etag = $client->getEtag();
+
+ $client = Client::getInstance();
+ $client->setUrl('http://php.net/robots.txt');
+ $client->setEtag($etag);
+ $client->execute();
+
+ $this->assertTrue($client->isModified());
+ }
+
+ public function testCacheEtag()
+ {
+ $client = Client::getInstance();
+ $client->setUrl('http://php.net/robots.txt');
+ $client->execute();
+ $etag = $client->getEtag();
+ $lastModified = $client->getLastModified();
+
+ $client = Client::getInstance();
+ $client->setUrl('http://php.net/robots.txt');
+ $client->setEtag($etag);
+ $client->setLastModified($lastModified);
+ $client->execute();
+
+ $this->assertFalse($client->isModified());
+ }
+
+ public function testCacheLastModified()
+ {
+ $client = Client::getInstance();
+ $client->setUrl('http://miniflux.net/humans.txt');
+ $client->execute();
+ $lastmod = $client->getLastModified();
+
+ $client = Client::getInstance();
+ $client->setUrl('http://miniflux.net/humans.txt');
+ $client->setLastModified($lastmod);
+ $client->execute();
+
+ $this->assertFalse($client->isModified());
+ }
+
+ public function testCacheBoth()
+ {
+ $client = Client::getInstance();
+ $client->setUrl('http://miniflux.net/humans.txt');
+ $client->execute();
+ $lastmod = $client->getLastModified();
+ $etag = $client->getEtag();
+
+ $client = Client::getInstance();
+ $client->setUrl('http://miniflux.net/humans.txt');
+ $client->setLastModified($lastmod);
+ $client->setEtag($etag);
+ $client->execute();
+
+ $this->assertFalse($client->isModified());
+ }
+
+ public function testCharset()
+ {
+ $client = Client::getInstance();
+ $client->setUrl('http://php.net/');
+ $client->execute();
+ $this->assertEquals('utf-8', $client->getEncoding());
+
+ $client = Client::getInstance();
+ $client->setUrl('http://php.net/robots.txt');
+ $client->execute();
+ $this->assertEquals('', $client->getEncoding());
+ }
+
+ public function testContentType()
+ {
+ $client = Client::getInstance();
+ $client->setUrl('http://miniflux.net/assets/img/favicon.png');
+ $client->execute();
+ $this->assertEquals('image/png', $client->getContentType());
+
+ $client = Client::getInstance();
+ $client->setUrl('http://miniflux.net/');
+ $client->execute();
+ $this->assertEquals('text/html; charset=utf-8', $client->getContentType());
+ }
+}
diff --git a/vendor/fguillot/picofeed/tests/Client/CurlTest.php b/vendor/fguillot/picofeed/tests/Client/CurlTest.php
new file mode 100644
index 000000000..4509dbc67
--- /dev/null
+++ b/vendor/fguillot/picofeed/tests/Client/CurlTest.php
@@ -0,0 +1,54 @@
+<?php
+namespace PicoFeed\Client;
+
+use PHPUnit_Framework_TestCase;
+
+
+class CurlTest extends PHPUnit_Framework_TestCase
+{
+ public function testDownload()
+ {
+ $client = new Curl;
+ $client->setUrl('http://miniflux.net/index.html');
+ $result = $client->doRequest();
+
+ $this->assertTrue(is_array($result));
+ $this->assertEquals(200, $result['status']);
+ $this->assertEquals('<!DOC', substr($result['body'], 0, 5));
+ $this->assertEquals('text/html; charset=utf-8', $result['headers']['Content-Type']);
+ }
+
+
+ public function testRedirect()
+ {
+ $client = new Curl;
+ $client->setUrl('http://www.miniflux.net/index.html');
+ $result = $client->doRequest();
+
+ $this->assertTrue(is_array($result));
+ $this->assertEquals(200, $result['status']);
+ $this->assertEquals('<!DOCTYPE', substr($result['body'], 0, 9));
+ $this->assertEquals('text/html; charset=utf-8', $result['headers']['Content-Type']);
+ $this->assertEquals('http://miniflux.net/', $client->getUrl());
+ }
+
+ /**
+ * @expectedException PicoFeed\Client\InvalidCertificateException
+ */
+ public function testSSL()
+ {
+ $client = new Curl;
+ $client->setUrl('https://www.mjvmobile.com.br');
+ $client->doRequest();
+ }
+
+ /**
+ * @expectedException PicoFeed\Client\InvalidUrlException
+ */
+ public function testBadUrl()
+ {
+ $client = new Curl;
+ $client->setUrl('http://12345gfgfgf');
+ $client->doRequest();
+ }
+} \ No newline at end of file
diff --git a/vendor/fguillot/picofeed/tests/Client/GrabberTest.php b/vendor/fguillot/picofeed/tests/Client/GrabberTest.php
new file mode 100644
index 000000000..8fc9c58a6
--- /dev/null
+++ b/vendor/fguillot/picofeed/tests/Client/GrabberTest.php
@@ -0,0 +1,67 @@
+<?php
+
+namespace PicoFeed\Client;
+
+use PHPUnit_Framework_TestCase;
+use PicoFeed\Reader\Reader;
+
+class GrabberTest extends PHPUnit_Framework_TestCase
+{
+ public function testGrabContentWithCandidates()
+ {
+ $grabber = new Grabber('http://theonion.com.feedsportal.com/c/34529/f/632231/s/309a7fe4/sc/20/l/0L0Stheonion0N0Carticles0Cobama0Ethrows0Eup0Eright0Ethere0Eduring0Esyria0Emeeting0H336850C/story01.htm');
+ $grabber->download();
+ $this->assertTrue($grabber->parse());
+
+ $grabber = new Grabber('http://www.lemonde.fr/proche-orient/article/2013/08/30/la-france-nouvelle-plus-ancienne-alliee-des-etats-unis_3469218_3218.html');
+ $grabber->download();
+ $this->assertTrue($grabber->parse());
+
+ $grabber = new Grabber('http://www.rue89.com/2013/08/30/faisait-boris-boillon-ex-sarko-boy-350-000-euros-gare-nord-245315');
+ $grabber->download();
+ $this->assertTrue($grabber->parse());
+
+ $grabber = new Grabber('http://www.inc.com/suzanne-lucas/why-employee-turnover-is-so-costly.html');
+ $grabber->download();
+ $this->assertTrue($grabber->parse());
+
+ $grabber = new Grabber('http://arstechnica.com/information-technology/2013/08/sysadmin-security-fail-nsa-finds-snowden-hijacked-officials-logins/');
+ $grabber->download();
+ $this->assertTrue($grabber->parse());
+ }
+
+ public function testGetRules()
+ {
+ $grabber = new Grabber('http://www.egscomics.com/index.php?id=1690');
+ $this->assertTrue(is_array($grabber->getRules()));
+ }
+
+ // 01net.com - https://github.com/fguillot/miniflux/issues/267
+ public function testGetRules_afterRedirection()
+ {
+ $grabber = new Grabber('http://rss.feedsportal.com/c/629/f/502199/s/422f8c8a/sc/44/l/0L0S0A1net0N0Ceditorial0C640A3130Cces0E20A150Eimprimer0Eune0Epizza0Eet0Edes0Ebiscuits0Evideo0C0T0Dxtor0FRSS0E16/story01.htm');
+ $grabber->download();
+ $this->assertTrue(is_array($grabber->getRules()));
+ }
+
+ public function testGrabContent()
+ {
+ $grabber = new Grabber('http://www.egscomics.com/index.php?id=1690');
+ $grabber->download();
+ $this->assertTrue($grabber->parse());
+
+ $this->assertEquals('<img title="2013-08-22" src="comics/../comics/1377151029-2013-08-22.png" id="comic" border="0" />', $grabber->getContent());
+ }
+
+ public function testRssGrabContent()
+ {
+ $reader = new Reader;
+ $client = $reader->download('http://www.egscomics.com/rss.php');
+ $parser = $reader->getParser($client->getUrl(), $client->getContent(), $client->getEncoding());
+ $parser->enableContentGrabber();
+ $feed = $parser->execute();
+
+ $this->assertTrue(is_array($feed->items));
+ $this->assertTrue(strpos($feed->items[0]->content, '<img') >= 0);
+ }
+}
diff --git a/vendor/fguillot/picofeed/tests/Client/HttpHeadersTest.php b/vendor/fguillot/picofeed/tests/Client/HttpHeadersTest.php
new file mode 100644
index 000000000..f577d00fa
--- /dev/null
+++ b/vendor/fguillot/picofeed/tests/Client/HttpHeadersTest.php
@@ -0,0 +1,19 @@
+<?php
+namespace PicoFeed\Client;
+
+use PHPUnit_Framework_TestCase;
+
+
+class HttpHeadersTest extends PHPUnit_Framework_TestCase
+{
+
+ public function testHttpHeadersSet() {
+ $headers = new HttpHeaders(array('Content-Type' => 'test'));
+ $this->assertEquals('test', $headers['content-typE']);
+ $this->assertTrue(isset($headers['ConTent-Type']));
+
+ unset($headers['Content-Type']);
+ $this->assertFalse(isset($headers['ConTent-Type']));
+ }
+
+} \ No newline at end of file
diff --git a/vendor/fguillot/picofeed/tests/Client/StreamTest.php b/vendor/fguillot/picofeed/tests/Client/StreamTest.php
new file mode 100644
index 000000000..91f52c898
--- /dev/null
+++ b/vendor/fguillot/picofeed/tests/Client/StreamTest.php
@@ -0,0 +1,65 @@
+<?php
+namespace PicoFeed\Client;
+
+use PHPUnit_Framework_TestCase;
+
+
+class StreamTest extends PHPUnit_Framework_TestCase
+{
+ public function testChunkedResponse()
+ {
+ $client = new Stream;
+ $client->setUrl('http://www.reddit.com/r/dwarffortress/.rss');
+ $result = $client->doRequest();
+
+ $this->assertEquals('</rss>', substr($result['body'], -6));
+ }
+
+ public function testDownload()
+ {
+ $client = new Stream;
+ $client->setUrl('https://github.com/fguillot/picoFeed');
+ $result = $client->doRequest();
+
+ $this->assertEquals(200, $result['status']);
+ $this->assertEquals('text/html; charset=utf-8', $result['headers']['Content-Type']);
+ $this->assertEquals('<!DOCTYPE html>', substr(trim($result['body']), 0, 15));
+ $this->assertEquals('</html>', substr(trim($result['body']), -7));
+ }
+
+ public function testRedirect()
+ {
+ $client = new Stream;
+ $client->setUrl('http://www.miniflux.net/index.html');
+ $result = $client->doRequest();
+
+ $this->assertTrue(is_array($result));
+ $this->assertEquals(200, $result['status']);
+ $this->assertEquals('<!DOCTYPE', substr($result['body'], 0, 9));
+ $this->assertEquals('text/html; charset=utf-8', $result['headers']['Content-Type']);
+ $this->assertEquals('http://miniflux.net/', $client->getUrl());
+ }
+
+ /**
+ * @expectedException PicoFeed\Client\InvalidUrlException
+ */
+ public function testBadUrl()
+ {
+ $client = new Stream;
+ $client->setUrl('http://12345gfgfgf');
+ $client->setTimeout(1);
+ $client->doRequest();
+ }
+
+ public function testDecodeGzip()
+ {
+ if (function_exists('gzdecode')) {
+ $client = new Stream;
+ $client->setUrl('https://github.com/fguillot/picoFeed');
+ $result = $client->doRequest();
+
+ $this->assertEquals('gzip', $result['headers']['Content-Encoding']);
+ $this->assertEquals('<!DOC', substr(trim($result['body']), 0, 5));
+ }
+ }
+} \ No newline at end of file
diff --git a/vendor/fguillot/picofeed/tests/Client/UrlTest.php b/vendor/fguillot/picofeed/tests/Client/UrlTest.php
new file mode 100644
index 000000000..f55d301c0
--- /dev/null
+++ b/vendor/fguillot/picofeed/tests/Client/UrlTest.php
@@ -0,0 +1,292 @@
+<?php
+
+namespace PicoFeed\Client;
+
+use PHPUnit_Framework_TestCase;
+
+class UrlTest extends PHPUnit_Framework_TestCase
+{
+ public function testHasScheme()
+ {
+ $url = new Url('http://www.google.fr/');
+ $this->assertTrue($url->hasScheme());<