summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/tests
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/fguillot/picofeed/tests')
-rw-r--r--vendor/fguillot/picofeed/tests/Client/ClientTest.php22
-rw-r--r--vendor/fguillot/picofeed/tests/Client/CurlTest.php8
-rw-r--r--vendor/fguillot/picofeed/tests/Client/GrabberTest.php12
-rw-r--r--vendor/fguillot/picofeed/tests/Client/StreamTest.php13
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php2
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/XmlParserTest.php64
-rw-r--r--vendor/fguillot/picofeed/tests/Reader/FaviconTest.php18
-rw-r--r--vendor/fguillot/picofeed/tests/Reader/ReaderTest.php12
8 files changed, 148 insertions, 3 deletions
diff --git a/vendor/fguillot/picofeed/tests/Client/ClientTest.php b/vendor/fguillot/picofeed/tests/Client/ClientTest.php
index 79592811b..b50837230 100644
--- a/vendor/fguillot/picofeed/tests/Client/ClientTest.php
+++ b/vendor/fguillot/picofeed/tests/Client/ClientTest.php
@@ -6,6 +6,9 @@ use PHPUnit_Framework_TestCase;
class ClientTest extends PHPUnit_Framework_TestCase
{
+ /**
+ * @group online
+ */
public function testDownload()
{
$client = Client::getInstance();
@@ -20,6 +23,7 @@ class ClientTest extends PHPUnit_Framework_TestCase
/**
* @runInSeparateProcess
+ * @group online
*/
public function testPassthrough()
{
@@ -31,6 +35,9 @@ class ClientTest extends PHPUnit_Framework_TestCase
$this->expectOutputString(file_get_contents('tests/fixtures/miniflux_favicon.ico'));
}
+ /**
+ * @group online
+ */
public function testCacheBothHaveToMatch()
{
$client = Client::getInstance();
@@ -46,6 +53,9 @@ class ClientTest extends PHPUnit_Framework_TestCase
$this->assertTrue($client->isModified());
}
+ /**
+ * @group online
+ */
public function testCacheEtag()
{
$client = Client::getInstance();
@@ -63,6 +73,9 @@ class ClientTest extends PHPUnit_Framework_TestCase
$this->assertFalse($client->isModified());
}
+ /**
+ * @group online
+ */
public function testCacheLastModified()
{
$client = Client::getInstance();
@@ -78,6 +91,9 @@ class ClientTest extends PHPUnit_Framework_TestCase
$this->assertFalse($client->isModified());
}
+ /**
+ * @group online
+ */
public function testCacheBoth()
{
$client = Client::getInstance();
@@ -95,6 +111,9 @@ class ClientTest extends PHPUnit_Framework_TestCase
$this->assertFalse($client->isModified());
}
+ /**
+ * @group online
+ */
public function testCharset()
{
$client = Client::getInstance();
@@ -108,6 +127,9 @@ class ClientTest extends PHPUnit_Framework_TestCase
$this->assertEquals('', $client->getEncoding());
}
+ /**
+ * @group online
+ */
public function testContentType()
{
$client = Client::getInstance();
diff --git a/vendor/fguillot/picofeed/tests/Client/CurlTest.php b/vendor/fguillot/picofeed/tests/Client/CurlTest.php
index e141a1f54..3ee249ff3 100644
--- a/vendor/fguillot/picofeed/tests/Client/CurlTest.php
+++ b/vendor/fguillot/picofeed/tests/Client/CurlTest.php
@@ -6,6 +6,9 @@ use PHPUnit_Framework_TestCase;
class CurlTest extends PHPUnit_Framework_TestCase
{
+ /**
+ * @group online
+ */
public function testDownload()
{
$client = new Curl;
@@ -20,6 +23,7 @@ class CurlTest extends PHPUnit_Framework_TestCase
/**
* @runInSeparateProcess
+ * @group online
*/
public function testPassthrough()
{
@@ -31,6 +35,9 @@ class CurlTest extends PHPUnit_Framework_TestCase
$this->expectOutputString(file_get_contents('tests/fixtures/miniflux_favicon.ico'));
}
+ /**
+ * @group online
+ */
public function testRedirect()
{
$client = new Curl;
@@ -46,6 +53,7 @@ class CurlTest extends PHPUnit_Framework_TestCase
/**
* @expectedException PicoFeed\Client\InvalidCertificateException
+ * @group online
*/
public function testSSL()
{
diff --git a/vendor/fguillot/picofeed/tests/Client/GrabberTest.php b/vendor/fguillot/picofeed/tests/Client/GrabberTest.php
index 8fc9c58a6..224dc14f1 100644
--- a/vendor/fguillot/picofeed/tests/Client/GrabberTest.php
+++ b/vendor/fguillot/picofeed/tests/Client/GrabberTest.php
@@ -7,6 +7,9 @@ use PicoFeed\Reader\Reader;
class GrabberTest extends PHPUnit_Framework_TestCase
{
+ /**
+ * @group online
+ */
public function testGrabContentWithCandidates()
{
$grabber = new Grabber('http://theonion.com.feedsportal.com/c/34529/f/632231/s/309a7fe4/sc/20/l/0L0Stheonion0N0Carticles0Cobama0Ethrows0Eup0Eright0Ethere0Eduring0Esyria0Emeeting0H336850C/story01.htm');
@@ -37,6 +40,9 @@ class GrabberTest extends PHPUnit_Framework_TestCase
}
// 01net.com - https://github.com/fguillot/miniflux/issues/267
+ /**
+ * @group online
+ */
public function testGetRules_afterRedirection()
{
$grabber = new Grabber('http://rss.feedsportal.com/c/629/f/502199/s/422f8c8a/sc/44/l/0L0S0A1net0N0Ceditorial0C640A3130Cces0E20A150Eimprimer0Eune0Epizza0Eet0Edes0Ebiscuits0Evideo0C0T0Dxtor0FRSS0E16/story01.htm');
@@ -44,6 +50,9 @@ class GrabberTest extends PHPUnit_Framework_TestCase
$this->assertTrue(is_array($grabber->getRules()));
}
+ /**
+ * @group online
+ */
public function testGrabContent()
{
$grabber = new Grabber('http://www.egscomics.com/index.php?id=1690');
@@ -53,6 +62,9 @@ class GrabberTest extends PHPUnit_Framework_TestCase
$this->assertEquals('<img title="2013-08-22" src="comics/../comics/1377151029-2013-08-22.png" id="comic" border="0" />', $grabber->getContent());
}
+ /**
+ * @group online
+ */
public function testRssGrabContent()
{
$reader = new Reader;
diff --git a/vendor/fguillot/picofeed/tests/Client/StreamTest.php b/vendor/fguillot/picofeed/tests/Client/StreamTest.php
index 314d488c3..9a72789a8 100644
--- a/vendor/fguillot/picofeed/tests/Client/StreamTest.php
+++ b/vendor/fguillot/picofeed/tests/Client/StreamTest.php
@@ -6,6 +6,9 @@ use PHPUnit_Framework_TestCase;
class StreamTest extends PHPUnit_Framework_TestCase
{
+ /**
+ * @group online
+ */
public function testChunkedResponse()
{
$client = new Stream;
@@ -15,6 +18,9 @@ class StreamTest extends PHPUnit_Framework_TestCase
$this->assertEquals('</rss>', substr($result['body'], -6));
}
+ /**
+ * @group online
+ */
public function testDownload()
{
$client = new Stream;
@@ -29,6 +35,7 @@ class StreamTest extends PHPUnit_Framework_TestCase
/**
* @runInSeparateProcess
+ * @group online
*/
public function testPassthrough()
{
@@ -40,6 +47,9 @@ class StreamTest extends PHPUnit_Framework_TestCase
$this->expectOutputString(file_get_contents('tests/fixtures/miniflux_favicon.ico'));
}
+ /**
+ * @group online
+ */
public function testRedirect()
{
$client = new Stream;
@@ -64,6 +74,9 @@ class StreamTest extends PHPUnit_Framework_TestCase
$client->doRequest();
}
+ /**
+ * @group online
+ */
public function testDecodeGzip()
{
if (function_exists('gzdecode')) {
diff --git a/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php b/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php
index 0f8d73694..71ee74f28 100644
--- a/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php
+++ b/vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php
@@ -94,7 +94,7 @@ class Rss20ParserTest extends PHPUnit_Framework_TestCase
$parser = new Rss20(file_get_contents('tests/fixtures/fulltextrss.xml'));
$feed = $parser->execute();
- $this->assertEquals(new DateTime, $feed->getDate());
+ $this->assertEquals(time(), $feed->getDate()->getTimestamp(), '', 1);
}
public function testFeedLanguage()
diff --git a/vendor/fguillot/picofeed/tests/Parser/XmlParserTest.php b/vendor/fguillot/picofeed/tests/Parser/XmlParserTest.php
index 38520ebfe..a849c58f2 100644
--- a/vendor/fguillot/picofeed/tests/Parser/XmlParserTest.php
+++ b/vendor/fguillot/picofeed/tests/Parser/XmlParserTest.php
@@ -17,8 +17,68 @@ class XmlParserTest extends PHPUnit_Framework_TestCase
public function testGetEncodingFromMetaTag()
{
- $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<html><head><meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"/></head></html>'));
- $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<html><head><meta charset="iso-8859-1"></head></html>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=\'Content-Type\' content=\'text/html;charset=iso-8859-1\'/>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=\'Content-Type\' content=\'text/html;charset=iso-8859-1\' />'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=Content-Type content=text/html;charset=iso-8859-1/>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=Content-Type content=text/html;charset=iso-8859-1 />'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" >'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=\'Content-Type\' content=\'text/html;charset=iso-8859-1\'>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=\'Content-Type\' content=\'text/html;charset=iso-8859-1\' >'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=Content-Type content=text/html;charset=iso-8859-1>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=Content-Type content=text/html;charset=iso-8859-1 >'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="text/html;charset=\'iso-8859-1\'">'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="\'text/html;charset=iso-8859-1\'">'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="\'text/html\';charset=\'iso-8859-1\'">'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=\'Content-Type\' content=\'text/html;charset="iso-8859-1"\'>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=\'Content-Type\' content=\'"text/html;charset=iso-8859-1"\'>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=\'Content-Type\' content=\'"text/html";charset="iso-8859-1"\'>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="text/html;;;charset=iso-8859-1">'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="text/html;;;charset=\'iso-8859-1\'">'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="\'text/html;;;charset=iso-8859-1\'">'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="\'text/html\';;;charset=\'iso-8859-1\'">'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=\'Content-Type\' content=\'text/html;;;charset=iso-8859-1\'>'));
+ $this->assertEquals('windows-1251', XmlParser::getEncodingFromMetaTag('<meta http-equiv=\'Content-Type\' content=\'text/html;;;charset="windows-1251"\'>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=\'Content-Type\' content=\'"text/html;;;charset=iso-8859-1"\'>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv=\'Content-Type\' content=\'"text/html";;;charset="iso-8859-1"\'>'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv = Content-Type content = text/html;charset=iso-8859-1 >'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta content = text/html;charset=iso-8859-1 http-equiv = Content-Type >'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv = Content-Type content = text/html ; charset = iso-8859-1 >'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta content = text/html ; charset = iso-8859-1 http-equiv = Content-Type >'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv = Content-Type content = text/html ;;; charset = iso-8859-1 >'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta content = text/html ;;; charset = iso-8859-1 http-equiv = Content-Type >'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv = Content-Type content = text/html ; ; ; charset = iso-8859-1 >'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta content = text/html ; ; ; charset = iso-8859-1 http-equiv = Content-Type >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset="uTf-8"/>'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset="utf-8" />'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset=\'Utf-8\'/>'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset=\'utf-8\' />'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset=utf-8/>'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset=utf-8 />'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset="utf-8">'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset="utf-8" >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset=\'utf-8\'>'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset=\'utf-8\' >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset=utf-8>'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset=utf-8 >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset = " utf-8 " >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset = \' utf-8 \' >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset = " utf-8 \' >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset = \' utf-8 " >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset = " utf-8 >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset = \' utf-8 >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset = utf-8 \' >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset = utf-8 " >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset = utf-8 >'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta charset = utf-8 />'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta name="title" value="charset=utf-8 — is it really useful (yep)?">'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta value="charset=utf-8 — is it really useful (yep)?" name="title">'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta name="title" content="charset=utf-8 — is it really useful (yep)?">'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta name="charset=utf-8" content="charset=utf-8 — is it really useful (yep)?">'));
+ $this->assertEquals('utf-8', XmlParser::getEncodingFromMetaTag('<meta content="charset=utf-8 — is it really useful (nope, not here, but gotta admit pretty robust otherwise)?" name="title">'));
+ $this->assertEquals('iso-8859-1', XmlParser::getEncodingFromMetaTag('<meta http-equiv="Content-Type" content="text/html;charset=iSo-8859-1"/><meta charset="invalid" />'));
}
public function testGetEncodingFromXmlTag()
diff --git a/vendor/fguillot/picofeed/tests/Reader/FaviconTest.php b/vendor/fguillot/picofeed/tests/Reader/FaviconTest.php
index 0652bc4af..81c9a04d6 100644
--- a/vendor/fguillot/picofeed/tests/Reader/FaviconTest.php
+++ b/vendor/fguillot/picofeed/tests/Reader/FaviconTest.php
@@ -77,6 +77,9 @@ class FaviconTest extends PHPUnit_Framework_TestCase
$this->assertEquals(array(), $favicon->extract($html));
}
+ /**
+ * @group online
+ */
public function testExists()
{
$favicon = new Favicon;
@@ -87,6 +90,9 @@ class FaviconTest extends PHPUnit_Framework_TestCase
$this->assertFalse($favicon->exists(''));
}
+ /**
+ * @group online
+ */
public function testFind_inMeta()
{
$favicon = new Favicon;
@@ -123,6 +129,9 @@ class FaviconTest extends PHPUnit_Framework_TestCase
$this->assertEmpty($favicon->getContent());
}
+ /**
+ * @group online
+ */
public function testFind_directLinkFirst()
{
$favicon = new Favicon;
@@ -135,6 +144,9 @@ class FaviconTest extends PHPUnit_Framework_TestCase
$this->assertNotEmpty($favicon->getContent());
}
+ /**
+ * @group online
+ */
public function testFind_fallsBackToExtract()
{
$favicon = new Favicon;
@@ -146,6 +158,9 @@ class FaviconTest extends PHPUnit_Framework_TestCase
$this->assertNotEmpty($favicon->getContent());
}
+ /**
+ * @group online
+ */
public function testDataUri()
{
$favicon = new Favicon;
@@ -160,6 +175,9 @@ class FaviconTest extends PHPUnit_Framework_TestCase
$this->assertEquals($expected, $favicon->getDataUri());
}
+ /**
+ * @group online
+ */
public function testDataUri_withBadContentType()
{
$favicon = new Favicon;
diff --git a/vendor/fguillot/picofeed/tests/Reader/ReaderTest.php b/vendor/fguillot/picofeed/tests/Reader/ReaderTest.php
index 1bd60ffee..821c6b9aa 100644
--- a/vendor/fguillot/picofeed/tests/Reader/ReaderTest.php
+++ b/vendor/fguillot/picofeed/tests/Reader/ReaderTest.php
@@ -15,6 +15,9 @@ class ReaderTest extends PHPUnit_Framework_TestCase
$this->assertEquals('https://google.com', $reader->prependScheme('https://google.com'));
}
+ /**
+ * @group online
+ */
public function testDownload_withHTTP()
{
$reader = new Reader;
@@ -22,6 +25,9 @@ class ReaderTest extends PHPUnit_Framework_TestCase
$this->assertNotEmpty($feed);
}
+ /**
+ * @group online
+ */
public function testDownload_withHTTPS()
{
$reader = new Reader;
@@ -29,6 +35,9 @@ class ReaderTest extends PHPUnit_Framework_TestCase
$this->assertNotEmpty($feed);
}
+ /**
+ * @group online
+ */
public function testDownload_withCache()
{
$reader = new Reader;
@@ -210,6 +219,9 @@ class ReaderTest extends PHPUnit_Framework_TestCase
$this->assertEquals(array(), $feeds);
}
+ /**
+ * @group online
+ */
public function testDiscover()
{
$reader = new Reader;