summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/tests/Client
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-12-17 09:01:54 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2014-12-17 09:02:13 +0100
commit867cb7dbf960dc0cfbf7e59d656d1337bb59c526 (patch)
tree5bbdf1eef51cd3747f55ef2c524364f9cd3bf029 /vendor/fguillot/picofeed/tests/Client
parenta813b535eeb517e0ccd69a90d0058756014a1e01 (diff)
update picofeed, fix #695
Diffstat (limited to 'vendor/fguillot/picofeed/tests/Client')
-rw-r--r--vendor/fguillot/picofeed/tests/Client/ClientTest.php20
-rw-r--r--vendor/fguillot/picofeed/tests/Client/FaviconTest.php143
2 files changed, 15 insertions, 148 deletions
diff --git a/vendor/fguillot/picofeed/tests/Client/ClientTest.php b/vendor/fguillot/picofeed/tests/Client/ClientTest.php
index 98a963644..0a480c5c0 100644
--- a/vendor/fguillot/picofeed/tests/Client/ClientTest.php
+++ b/vendor/fguillot/picofeed/tests/Client/ClientTest.php
@@ -1,9 +1,9 @@
<?php
+
namespace PicoFeed\Client;
use PHPUnit_Framework_TestCase;
-
class ClientTest extends PHPUnit_Framework_TestCase
{
public function testDownload()
@@ -18,7 +18,6 @@ class ClientTest extends PHPUnit_Framework_TestCase
$this->assertNotEmpty($client->getLastModified());
}
-
public function testCacheEtag()
{
$client = Client::getInstance();
@@ -34,7 +33,6 @@ class ClientTest extends PHPUnit_Framework_TestCase
$this->assertFalse($client->isModified());
}
-
public function testCacheLastModified()
{
$client = Client::getInstance();
@@ -50,7 +48,6 @@ class ClientTest extends PHPUnit_Framework_TestCase
$this->assertFalse($client->isModified());
}
-
public function testCacheBoth()
{
$client = Client::getInstance();
@@ -80,4 +77,17 @@ class ClientTest extends PHPUnit_Framework_TestCase
$client->execute();
$this->assertEquals('', $client->getEncoding());
}
-} \ No newline at end of file
+
+ 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/FaviconTest.php b/vendor/fguillot/picofeed/tests/Client/FaviconTest.php
deleted file mode 100644
index c0ac11ac6..000000000
--- a/vendor/fguillot/picofeed/tests/Client/FaviconTest.php
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-namespace PicoFeed\Client;
-
-use PHPUnit_Framework_TestCase;
-
-
-class FaviconTest extends PHPUnit_Framework_TestCase
-{
- public function testExtract()
- {
- $favicon = new Favicon;
-
- $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));
-
- $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));
-
- $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));
-
- $html = '<!DOCTYPE html><html><head>
- <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));
-
- $html = '<!DOCTYPE html><html><head>
- <link rel="icon" type="image/gif" href="http://example.com/image.gif" />
- </head><body><p>boo</p></body></html>';
-
- $this->assertEquals(array('http://example.com/image.gif'), $favicon->extract($html));
-
- $html = '<!DOCTYPE html><html><head>
- <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.ico'), $favicon->extract($html));
-
- $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" />
- <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));
- }
-/*
- public function testHasFile()
- {
- $favicon = new Favicon;
- $this->assertTrue($favicon->exists('https://en.wikipedia.org/favicon.ico'));
- $this->assertFalse($favicon->exists('http://minicoders.com/favicon.ico'));
- $this->assertFalse($favicon->exists('http://blabla'));
- }
-*/
- public function testConvertLink()
- {
- $favicon = new Favicon;
-
- $this->assertEquals(
- 'http://miniflux.net/assets/img/favicon.png',
- $favicon->convertLink(new Url('http://miniflux.net'), new Url('assets/img/favicon.png'))
- );
-
- $this->assertEquals(
- 'https://miniflux.net/assets/img/favicon.png',
- $favicon->convertLink(new Url('https://miniflux.net'), new Url('assets/img/favicon.png'))
- );
-
- $this->assertEquals(
- 'http://google.com/assets/img/favicon.png',
- $favicon->convertLink(new Url('http://miniflux.net'), new Url('//google.com/assets/img/favicon.png'))
- );
-
- $this->assertEquals(
- 'https://google.com/assets/img/favicon.png',
- $favicon->convertLink(new Url('https://miniflux.net'), new Url('//google.com/assets/img/favicon.png'))
- );
- }
-
- public function testFind()
- {
- $favicon = new Favicon;
-
- // Relative favicon in html
- $this->assertEquals(
- 'http://miniflux.net/assets/img/favicon.png',
- $favicon->find('http://miniflux.net')
- );
-
- $this->assertNotEmpty($favicon->getContent());
-
- // Absolute html favicon
- $this->assertEquals(
- 'http://php.net/favicon.ico',
- $favicon->find('http://php.net/parse_url')
- );
-
- $this->assertNotEmpty($favicon->getContent());
-
- // Protocol relative favicon
- $this->assertEquals(
- 'https://bits.wikimedia.org/favicon/wikipedia.ico',
- $favicon->find('https://en.wikipedia.org/')
- );
-
- $this->assertNotEmpty($favicon->getContent());
-
- // fluid-icon + https
- $this->assertEquals(
- 'https://github.com/fluidicon.png',
- $favicon->find('https://github.com')
- );
-
- $this->assertNotEmpty($favicon->getContent());
-
- // favicon in meta
- $this->assertEquals(
- 'http://www.microsoft.com/favicon.ico?v2',
- $favicon->find('http://www.microsoft.com')
- );
-
- $this->assertNotEmpty($favicon->getContent());
-
- // no icon
- $this->assertEquals(
- '',
- $favicon->find('http://minicoders.com/favicon.ico')
- );
-
- $this->assertEmpty($favicon->getContent());
- }
-}