summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/tests/Filter
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/fguillot/picofeed/tests/Filter')
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/AttributeFilterTest.php324
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/FilterTest.php122
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php173
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/TagFilterTest.php33
4 files changed, 0 insertions, 652 deletions
diff --git a/vendor/fguillot/picofeed/tests/Filter/AttributeFilterTest.php b/vendor/fguillot/picofeed/tests/Filter/AttributeFilterTest.php
deleted file mode 100644
index 6c68ef433..000000000
--- a/vendor/fguillot/picofeed/tests/Filter/AttributeFilterTest.php
+++ /dev/null
@@ -1,324 +0,0 @@
-<?php
-namespace PicoFeed\Filter;
-
-use PHPUnit_Framework_TestCase;
-
-use PicoFeed\Client\Url;
-use PicoFeed\Config\Config;
-
-
-class AttributeFilterTest extends PHPUnit_Framework_TestCase
-{
- public function testFilterEmptyAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterEmptyAttribute('abbr', 'title', 'test'));
- $this->assertFalse($filter->filterEmptyAttribute('abbr', 'title', ''));
- $this->assertEquals(array('title' => 'test'), $filter->filter('abbr', array('title' => 'test')));
- $this->assertEquals(array(), $filter->filter('abbr', array('title' => '')));
- }
-
- public function testFilterAllowedAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterAllowedAttribute('abbr', 'title', 'test'));
- $this->assertFalse($filter->filterAllowedAttribute('script', 'type', 'text/javascript'));
-
- $this->assertEquals(array(), $filter->filter('script', array('type' => 'text/javascript')));
- $this->assertEquals(array(), $filter->filter('a', array('onclick' => 'javascript')));
- $this->assertEquals(array('href' => 'http://google.com/'), $filter->filter('a', array('href' => 'http://google.com')));
- }
-
- public function testFilterIntegerAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterIntegerAttribute('abbr', 'title', 'test'));
- $this->assertTrue($filter->filterIntegerAttribute('iframe', 'width', '0'));
- $this->assertTrue($filter->filterIntegerAttribute('iframe', 'width', '450'));
- $this->assertFalse($filter->filterIntegerAttribute('iframe', 'width', 'test'));
-
- $this->assertEquals(array('width' => '10', 'src' => 'https://www.youtube.com/test'), $filter->filter('iframe', array('width' => '10', 'src' => 'http://www.youtube.com/test')));
- $this->assertEquals(array('src' => 'https://www.youtube.com/test'), $filter->filter('iframe', array('width' => 'test', 'src' => 'http://www.youtube.com/test')));
- }
-
- public function testRewriteProxyImageUrl()
- {
- $filter = new Attribute(new Url('http://www.la-grange.net'));
- $url = '/2014/08/03/4668-noisettes';
- $this->assertTrue($filter->rewriteImageProxyUrl('a', 'href', $url));
- $this->assertEquals('/2014/08/03/4668-noisettes', $url);
-
- $filter = new Attribute(new Url('http://www.la-grange.net'));
- $url = '/2014/08/03/4668-noisettes';
- $this->assertTrue($filter->rewriteImageProxyUrl('img', 'alt', $url));
- $this->assertEquals('/2014/08/03/4668-noisettes', $url);
-
- $filter = new Attribute(new Url('http://www.la-grange.net'));
- $url = '/2014/08/03/4668-noisettes';
- $this->assertTrue($filter->rewriteImageProxyUrl('img', 'src', $url));
- $this->assertEquals('/2014/08/03/4668-noisettes', $url);
-
- $filter = new Attribute(new Url('http://www.la-grange.net'));
- $filter->setImageProxyUrl('https://myproxy/?u=%s');
- $url = 'http://example.net/image.png';
- $this->assertTrue($filter->rewriteImageProxyUrl('img', 'src', $url));
- $this->assertEquals('https://myproxy/?u='.rawurlencode('http://example.net/image.png'), $url);
-
- $filter = new Attribute(new Url('http://www.la-grange.net'));
-
- $filter->setImageProxyCallback(function ($image_url) {
- $key = hash_hmac('sha1', $image_url, 'secret');
- return 'https://mypublicproxy/'.$key.'/'.rawurlencode($image_url);
- });
-
- $url = 'http://example.net/image.png';
- $this->assertTrue($filter->rewriteImageProxyUrl('img', 'src', $url));
- $this->assertEquals('https://mypublicproxy/d9701029b054f6e178ef88fcd3c789365e52a26d/'.rawurlencode('http://example.net/image.png'), $url);
- }
-
- public function testRewriteAbsoluteUrl()
- {
- $filter = new Attribute(new Url('http://www.la-grange.net'));
- $url = '/2014/08/03/4668-noisettes';
- $this->assertTrue($filter->rewriteAbsoluteUrl('a', 'href', $url));
- $this->assertEquals('http://www.la-grange.net/2014/08/03/4668-noisettes', $url);
-
- $filter = new Attribute(new Url('http://google.com'));
-
- $url = 'test';
- $this->assertTrue($filter->rewriteAbsoluteUrl('a', 'href', $url));
- $this->assertEquals('http://google.com/test', $url);
-
- $url = 'http://127.0.0.1:8000/test';
- $this->assertTrue($filter->rewriteAbsoluteUrl('img', 'src', $url));
- $this->assertEquals('http://127.0.0.1:8000/test', $url);
-
- $url = '//example.com';
- $this->assertTrue($filter->rewriteAbsoluteUrl('a', 'href', $url));
- $this->assertEquals('http://example.com/', $url);
-
- $filter = new Attribute(new Url('https://google.com'));
- $url = '//example.com/?youpi';
- $this->assertTrue($filter->rewriteAbsoluteUrl('a', 'href', $url));
- $this->assertEquals('https://example.com/?youpi', $url);
-
- $filter = new Attribute(new Url('https://127.0.0.1:8000/here/'));
- $url = 'image.png?v=2';
- $this->assertTrue($filter->rewriteAbsoluteUrl('a', 'href', $url));
- $this->assertEquals('https://127.0.0.1:8000/here/image.png?v=2', $url);
-
- $filter = new Attribute(new Url('https://truc/'));
- $this->assertEquals(array('src' => 'https://www.youtube.com/test'), $filter->filter('iframe', array('width' => 'test', 'src' => '//www.youtube.com/test')));
-
- $filter = new Attribute(new Url('http://truc/'));
- $this->assertEquals(array('href' => 'http://google.fr/'), $filter->filter('a', array('href' => '//google.fr')));
- }
-
- public function testFilterIframeAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterIframeAttribute('iframe', 'src', 'http://www.youtube.com/test'));
- $this->assertTrue($filter->filterIframeAttribute('iframe', 'src', 'https://www.youtube.com/test'));
- $this->assertFalse($filter->filterIframeAttribute('iframe', 'src', '//www.youtube.com/test'));
- $this->assertFalse($filter->filterIframeAttribute('iframe', 'src', '//www.bidule.com/test'));
-
- $this->assertEquals(array('src' => 'https://www.youtube.com/test'), $filter->filter('iframe', array('src' => '//www.youtube.com/test')));
- }
-
- public function testRemoveYouTubeAutoplay()
- {
- $filter = new Attribute(new Url('http://google.com'));
- $urls = array(
- 'https://www.youtube.com/something/?autoplay=1' => 'https://www.youtube.com/something/?autoplay=0',
- 'https://www.youtube.com/something/?test=s&autoplay=1&a=2' => 'https://www.youtube.com/something/?test=s&autoplay=0&a=2',
- 'https://www.youtube.com/something/?test=s' => 'https://www.youtube.com/something/?test=s',
- 'https://youtube.com/something/?autoplay=1' => 'https://youtube.com/something/?autoplay=0',
- 'https://youtube.com/something/?test=s&autoplay=1&a=2' => 'https://youtube.com/something/?test=s&autoplay=0&a=2',
- 'https://youtube.com/something/?test=s' => 'https://youtube.com/something/?test=s',
- );
-
- foreach ($urls as $before => $after) {
- $filter->removeYouTubeAutoplay('iframe', 'src', $before);
- $this->assertEquals($after, $before);
- }
- }
-
- public function testFilterBlacklistAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterBlacklistResourceAttribute('a', 'href', 'http://google.fr/'));
- $this->assertFalse($filter->filterBlacklistResourceAttribute('a', 'href', 'http://res3.feedsportal.com/truc'));
-
- $this->assertEquals(array('href' => 'http://google.fr/'), $filter->filter('a', array('href' => 'http://google.fr/')));
- $this->assertEquals(array(), $filter->filter('a', array('href' => 'http://res3.feedsportal.com/')));
- }
-
- public function testFilterProtocolAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterProtocolUrlAttribute('a', 'href', 'http://google.fr/'));
- $this->assertFalse($filter->filterProtocolUrlAttribute('a', 'href', 'bla://google.fr/'));
- $this->assertFalse($filter->filterProtocolUrlAttribute('a', 'href', 'javascript:alert("test")'));
-
- $this->assertEquals(array('href' => 'http://google.fr/'), $filter->filter('a', array('href' => 'http://google.fr/')));
- $this->assertEquals(array(), $filter->filter('a', array('href' => 'bla://google.fr/')));
- }
-
- public function testRequiredAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->hasRequiredAttributes('a', array('href' => 'bla')));
- $this->assertTrue($filter->hasRequiredAttributes('img', array('src' => 'bla')));
- $this->assertTrue($filter->hasRequiredAttributes('source', array('src' => 'bla')));
- $this->assertTrue($filter->hasRequiredAttributes('audio', array('src' => 'bla')));
- $this->assertTrue($filter->hasRequiredAttributes('iframe', array('src' => 'bla')));
- $this->assertTrue($filter->hasRequiredAttributes('p', array('class' => 'bla')));
- $this->assertFalse($filter->hasRequiredAttributes('a', array('title' => 'bla')));
- }
-
- public function testHtml()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertEquals('title="A &amp; B"', $filter->toHtml(array('title' => 'A & B')));
- $this->assertEquals('title="&quot;a&quot;"', $filter->toHtml(array('title' => '"a"')));
- $this->assertEquals('title="ç" alt="b"', $filter->toHtml(array('title' => 'ç', 'alt' => 'b')));
- }
-
- public function testNoImageProxySet()
- {
- $f = Filter::html('<p>Image <img src="/image.png" alt="My Image"/></p>', 'http://foo');
-
- $this->assertEquals(
- '<p>Image <img src="http://foo/image.png" alt="My Image"/></p>',
- $f->execute()
- );
- }
-
- public function testImageProxyWithHTTPLink()
- {
- $config = new Config;
- $config->setFilterImageProxyUrl('http://myproxy/?url=%s');
-
- $f = Filter::html('<p>Image <img src="http://localhost/image.png" alt="My Image"/></p>', 'http://foo');
- $f->setConfig($config);
-
- $this->assertEquals(
- '<p>Image <img src="http://myproxy/?url='.rawurlencode('http://localhost/image.png').'" alt="My Image"/></p>',
- $f->execute()
- );
- }
-
- public function testImageProxyWithHTTPSLink()
- {
- $config = new Config;
- $config->setFilterImageProxyUrl('http://myproxy/?url=%s');
-
- $f = Filter::html('<p>Image <img src="https://localhost/image.png" alt="My Image"/></p>', 'http://foo');
- $f->setConfig($config);
-
- $this->assertEquals(
- '<p>Image <img src="http://myproxy/?url='.rawurlencode('https://localhost/image.png').'" alt="My Image"/></p>',
- $f->execute()
- );
- }
-
- public function testImageProxyLimitedToUnknownProtocol()
- {
- $config = new Config;
- $config->setFilterImageProxyUrl('http://myproxy/?url=%s');
- $config->setFilterImageProxyProtocol('tripleX');
-
- $f = Filter::html('<p>Image <img src="http://localhost/image.png" alt="My Image"/></p>', 'http://foo');
- $f->setConfig($config);
-
- $this->assertEquals(
- '<p>Image <img src="http://localhost/image.png" alt="My Image"/></p>',
- $f->execute()
- );
- }
-
- public function testImageProxyLimitedToHTTPwithHTTPLink()
- {
- $config = new Config;
- $config->setFilterImageProxyUrl('http://myproxy/?url=%s');
- $config->setFilterImageProxyProtocol('http');
-
- $f = Filter::html('<p>Image <img src="http://localhost/image.png" alt="My Image"/></p>', 'http://foo');
- $f->setConfig($config);
-
- $this->assertEquals(
- '<p>Image <img src="http://myproxy/?url='.rawurlencode('http://localhost/image.png').'" alt="My Image"/></p>',
- $f->execute()
- );
- }
-
- public function testImageProxyLimitedToHTTPwithHTTPSLink()
- {
- $config = new Config;
- $config->setFilterImageProxyUrl('http://myproxy/?url=%s');
- $config->setFilterImageProxyProtocol('http');
-
- $f = Filter::html('<p>Image <img src="https://localhost/image.png" alt="My Image"/></p>', 'http://foo');
- $f->setConfig($config);
-
- $this->assertEquals(
- '<p>Image <img src="https://localhost/image.png" alt="My Image"/></p>',
- $f->execute()
- );
- }
-
- public function testImageProxyLimitedToHTTPSwithHTTPLink()
- {
- $config = new Config;
- $config->setFilterImageProxyUrl('http://myproxy/?url=%s');
- $config->setFilterImageProxyProtocol('https');
-
- $f = Filter::html('<p>Image <img src="http://localhost/image.png" alt="My Image"/></p>', 'http://foo');
- $f->setConfig($config);
-
- $this->assertEquals(
- '<p>Image <img src="http://localhost/image.png" alt="My Image"/></p>',
- $f->execute()
- );
- }
-
- public function testImageProxyLimitedToHTTPSwithHTTPSLink()
- {
- $config = new Config;
- $config->setFilterImageProxyUrl('http://myproxy/?url=%s');
- $config->setFilterImageProxyProtocol('https');
-
- $f = Filter::html('<p>Image <img src="https://localhost/image.png" alt="My Image"/></p>', 'http://foo');
- $f->setConfig($config);
-
- $this->assertEquals(
- '<p>Image <img src="http://myproxy/?url='.rawurlencode('https://localhost/image.png').'" alt="My Image"/></p>',
- $f->execute()
- );
- }
-
- public function testsetFilterImageProxyCallback()
- {
- $config = new Config;
- $config->setFilterImageProxyCallback(function ($image_url) {
- $key = hash_hmac('sha1', $image_url, 'secret');
- return 'https://mypublicproxy/'.$key.'/'.rawurlencode($image_url);
- });
-
- $f = Filter::html('<p>Image <img src="/image.png" alt="My Image"/></p>', 'http://foo');
- $f->setConfig($config);
-
- $this->assertEquals(
- '<p>Image <img src="https://mypublicproxy/4924964043f3119b3cf2b07b1922d491bcc20092/'.rawurlencode('http://foo/image.png').'" alt="My Image"/></p>',
- $f->execute()
- );
- }
-}
diff --git a/vendor/fguillot/picofeed/tests/Filter/FilterTest.php b/vendor/fguillot/picofeed/tests/Filter/FilterTest.php
deleted file mode 100644
index 29cff4668..000000000
--- a/vendor/fguillot/picofeed/tests/Filter/FilterTest.php
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-namespace PicoFeed\Filter;
-
-use PHPUnit_Framework_TestCase;
-
-use PicoFeed\Config\Config;
-
-
-class FilterTest extends PHPUnit_Framework_TestCase
-{
- public function testStripHeadTag()
- {
- $input = '<html><head><title>test</title></head><body><h1>boo</h1></body>';
- $expected = '<html><body><h1>boo</h1></body>';
- $this->assertEquals($expected, Filter::stripHeadTags($input));
-
- $input = file_get_contents('tests/fixtures/html4_page.html');
- $expected = file_get_contents('tests/fixtures/html4_head_stripped_page.html');
- $this->assertEquals($expected, Filter::stripHeadTags($input));
-
- $input = file_get_contents('tests/fixtures/html_page.html');
- $expected = file_get_contents('tests/fixtures/html_head_stripped_page.html');
- $this->assertEquals($expected, Filter::stripHeadTags($input));
- }
-
- public function testStripXmlTag()
- {
- $data = file_get_contents('tests/fixtures/jeux-linux.fr.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/ezrss.it');
- $this->assertEquals('<!DOC', substr(Filter::stripXmlTag($data), 0, 5));
-
- $data = file_get_contents('tests/fixtures/fulltextrss.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/sametmax.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/ibash.ru.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/pcinpact.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/resorts.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/rue89.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/cercle.psy.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/lagrange.xml');
- $this->assertEquals('<feed', substr(Filter::stripXmlTag($data), 0, 5));
-
- $data = file_get_contents('tests/fixtures/googleblog.xml');
- $this->assertEquals('<feed', substr(trim(Filter::stripXmlTag($data)), 0, 5));
-
- $data = file_get_contents('tests/fixtures/atomsample.xml');
- $this->assertEquals('<feed', substr(trim(Filter::stripXmlTag($data)), 0, 5));
-
- $data = file_get_contents('tests/fixtures/planete-jquery.xml');
- $this->assertEquals('<rdf:RDF', trim(substr(trim(Filter::stripXmlTag($data)), 0, 8)));
- }
-
- public function testOverrideFilters()
- {
- $data = '<iframe src="http://www.kickstarter.com/projects/lefnire/habitrpg-mobile/widget/video.html" height="480" width="640" frameborder="0"></iframe>';
- $expected = '<iframe src="https://www.kickstarter.com/projects/lefnire/habitrpg-mobile/widget/video.html" height="480" width="640" frameborder="0"></iframe>';
-
- $f = Filter::html($data, 'http://blabla');
- $f->attribute->setIframeWhitelist(array('http://www.kickstarter.com'));
- $this->assertEquals($expected, $f->execute());
-
- $data = '<iframe src="http://www.youtube.com/bla" height="480" width="640" frameborder="0"></iframe>';
-
- $f = Filter::html($data, 'http://blabla');
- $f->attribute->setIframeWhitelist(array('http://www.kickstarter.com'));
- $this->assertEmpty($f->execute());
-
- $config = new Config;
- $config->setFilterWhitelistedTags(array('p' => array('title')));
-
- $f = Filter::html('<p>Test<strong>boo</strong></p>', 'http://blabla');
- $f->setConfig($config);
- $this->assertEquals('<p>Testboo</p>', $f->execute());
- }
-
- public function testNormalizeData()
- {
- // invalid data link escape control character
- $this->assertEquals('<xml>random text</xml>', Filter::normalizeData("<xml>random\x10 text</xml>"));
- $this->assertEquals('<xml>random text</xml>', Filter::normalizeData("<xml>random&#x10; text</xml>"));
- $this->assertEquals('<xml>random text</xml>', Filter::normalizeData("<xml>random&#16; text</xml>"));
-
- // invalid unit seperator control character (lower and upper case)
- $this->assertEquals('<xml>random text</xml>', Filter::normalizeData("<xml>random\x1f text</xml>"));
- $this->assertEquals('<xml>random text</xml>', Filter::normalizeData("<xml>random\x1F text</xml>"));
- $this->assertEquals('<xml>random text</xml>', Filter::normalizeData("<xml>random&#x1f; text</xml>"));
- $this->assertEquals('<xml>random text</xml>', Filter::normalizeData("<xml>random&#x1F; text</xml>"));
- $this->assertEquals('<xml>random text</xml>', Filter::normalizeData("<xml>random&#31; text</xml>"));
-
- /*
- * Do not test invalid multibyte characters. The output depends on php
- * version and character.
- *
- * php 5.3: always null
- * php >5.3: sometime null, sometimes the stripped string
- */
-
- // invalid backspace control character + valid multibyte character
- $this->assertEquals('<xml>“random“ text</xml>', Filter::normalizeData("<xml>\xe2\x80\x9crandom\xe2\x80\x9c\x08 text</xml>"));
- $this->assertEquals('<xml>&#x201C;random&#x201C; text</xml>', Filter::normalizeData("<xml>&#x201C;random&#x201C;&#x08; text</xml>"));
- $this->assertEquals('<xml>&#8220;random&#8220; text</xml>', Filter::normalizeData("<xml>&#8220;random&#8220;&#08; text</xml>"));
-
- // do not convert valid entities to utf-8 character
- $this->assertEquals('<xml attribute="&#34;value&#34;">random text</xml>', Filter::normalizeData('<xml attribute="&#34;value&#34;">random text</xml>'));
- $this->assertEquals('<xml attribute="&#x22;value&#x22;">random text</xml>', Filter::normalizeData('<xml attribute="&#x22;value&#x22;">random text</xml>'));
- }
-} \ No newline at end of file
diff --git a/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php b/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php
deleted file mode 100644
index 9149e59bc..000000000
--- a/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php
+++ /dev/null
@@ -1,173 +0,0 @@
-<?php
-
-namespace PicoFeed\Filter;
-
-use PHPUnit_Framework_TestCase;
-
-class HtmlFilterTest extends PHPUnit_Framework_TestCase
-{
- public function testEmpty()
- {
- $filter = new Html('', 'http://www.google.ca/');
- $this->assertEquals('', $filter->execute());
- }
-
- public function testExecute()
- {
- $html = '<!DOCTYPE html><html><head>
- <meta name="title" content="test">
- </head><body><p>boo<br/><strong>foo</strong>.</p></body></html>';
-
- $filter = new Html($html, 'http://www.google.ca/');
-
- $this->assertEquals('<p>boo<br/><strong>foo</strong>.</p>', $filter->execute());
- }
-
- public function testFilterRules()
- {
- $html = '<p><a href="http://www.twogag.com/archives/3455" title="559 &#8211; The Cookie">' .
- '<img src="http://www.twogag.com/comics-rss/2015-04-17-TGAG_559_The_Cookie.jpg" alt="559 &#8211; The Cookie" class="comicthumbnail" title="559 &#8211; The Cookie" /></a></p>'.
- 'I always throw up in hindsight if I find out something I ate was vegan. Twogag&#8217;s super free but if you want to support the comic look no further than the Twogag patreon!';
-
- $filter = new Html($html, 'http://www.twogag.com/');
-
- $expected = '<p><a href="http://www.twogag.com/archives/3455" rel="noreferrer" target="_blank">' .
- '<img src="http://www.twogag.com/comics/2015-04-17-TGAG_559_The_Cookie.jpg" alt="559 – The Cookie" title="559 – The Cookie"/></a></p>'.
- 'I always throw up in hindsight if I find out something I ate was vegan. Twogag’s super free but if you want to support the comic look no further than the Twogag patreon!';
-
- $this->assertEquals($expected, $filter->execute());
- }
-
-
- public function testIframe()
- {
- $data = '<iframe src="http://www.kickstarter.com/projects/lefnire/habitrpg-mobile/widget/video.html" height="480" width="640" frameborder="0"></iframe>';
-
- $f = new Html($data, 'http://blabla');
- $this->assertEmpty($f->execute());
-
- $data = '<iframe src="http://www.youtube.com/bla" height="480" width="640" frameborder="0"></iframe>';
- $expected = '<iframe src="https://www.youtube.com/bla" height="480" width="640" frameborder="0"></iframe>';
-
- $f = new Html($data, 'http://blabla');
- $this->assertEquals($expected, $f->execute());
- }
-
- public function testClearScriptAttributes()
- {
- $data = '<div><script>this is the content</script><script>blubb content</script><p>something</p></div><p>hi</p>';
-
- $f = new Html($data, 'http://blabla');
- $expected = '<p>something</p><p>hi</p>';
- $this->assertEquals($expected, $f->execute());
- }
-
- public function testClearStyleAttributes()
- {
- $data = '<div><style>this is the content</style><style>blubb content</style><p>something</p></div><p>hi</p>';
-
- $f = new Html($data, 'http://blabla');
- $expected = '<p>something</p><p>hi</p>';
- $this->assertEquals($expected, $f->execute());
- }
-
- public function testEmptyTags()
- {
- $data = <<<EOD
-<div>
-<a href="file://path/to/a/file">
- <img src="http://example.com/image.png" />
-</a>
-</div>
-EOD;
- $f = new Html($data, 'http://blabla');
- $output = $f->execute();
-
- $this->assertEquals('<img src="http://example.com/image.png"/>', $output);
- }
-
- public function testBadAttributes()
- {
- $data = '<iframe src="http://www.youtube.com/bla" height="480px" width="100%" frameborder="0"></iframe>';
-
- $f = new Html($data, 'http://blabla');
- $this->assertEquals('<iframe src="https://www.youtube.com/bla" frameborder="0"></iframe>', $f->execute());
- }
-
- public function testRelativeScheme()
- {
- $f = new Html('<a href="//linuxfr.org">link</a>', 'http://blabla');
- $this->assertEquals('<a href="http://linuxfr.org/" rel="noreferrer" target="_blank">link</a>', $f->execute());
- }
-
- public function testAttributes()
- {
- $f = new Html('<img src="foo" title="\'quote" alt="\'quote" data-src="bar" data-truc="boo"/>', 'http://blabla');
- $this->assertEquals('<img src="http://blabla/foo" title="&#039;quote" alt="&#039;quote"/>', $f->execute());
-
- $f = new Html('<img src="foo&bar=\'quote"/>', 'http://blabla');
- $this->assertEquals('<img src="http://blabla/foo&amp;bar=&#039;quote"/>', $f->execute());
-
- $f = new Html("<time datetime='quote\"here'>bla</time>", 'http://blabla');
- $this->assertEquals('<time datetime="quote&quot;here">bla</time>', $f->execute());
- }
-
- public function testCode()
- {
- $data = '<pre><code>HEAD / HTTP/1.1
-Accept: text/html
-Accept-Encoding: gzip, deflate, compress
-Host: www.amazon.com
-User-Agent: HTTPie/0.6.0
-
-
-
-<strong>HTTP/1.1 405 MethodNotAllowed</strong>
-Content-Encoding: gzip
-Content-Type: text/html; charset=ISO-8859-1
-Date: Mon, 15 Jul 2013 02:05:59 GMT
-Server: Server
-Set-Cookie: skin=noskin; path=/; domain=.amazon.com; expires=Mon, 15-Jul-2013 02:05:59 GMT
-Vary: Accept-Encoding,User-Agent
-<strong>allow: POST, GET</strong>
-x-amz-id-1: 11WD3K15FC268R5GBJY5
-x-amz-id-2: DDjqfqz2ZJufzqRAcj1mh+9XvSogrPohKHwXlo8IlkzH67G6w4wnjn9HYgbs4uI0
-</code></pre>';
-
- $f = new Html($data, 'http://blabla');
- $this->assertEquals($data, $f->execute());
- }
-
- public function testRemoveNoBreakingSpace()
- {
- $f = new Html('<p>&nbsp;&nbsp;truc</p>', 'http://blabla');
- $this->assertEquals('<p> truc</p>', $f->execute());
- }
-
- public function testRemoveEmptyTags()
- {
- $f = new Html('<p>toto</p><p></p><br/>', 'http://blabla');
- $this->assertEquals('<p>toto</p><br/>', $f->execute());
-
- $f = new Html('<p> </p>', 'http://blabla');
- $this->assertEquals('', $f->execute());
-
- $f = new Html('<p>&nbsp;</p>', 'http://blabla');
- $this->assertEquals('', $f->execute());
- }
-
- public function testRemoveEmptyTable()
- {
- $f = new Html('<table><tr><td> </td></tr></table>', 'http://blabla');
- $this->assertEquals('', $f->execute());
-
- $f = new Html('<table><tr></tr></table>', 'http://blabla');
- $this->assertEquals('', $f->execute());
- }
-
- public function testRemoveMultipleTags()
- {
- $f = new Html('<br/><br/><p>toto</p><br/><br/><br/><p>momo</p><br/><br/><br/><br/>', 'http://blabla');
- $this->assertEquals('<br/><p>toto</p><br/><p>momo</p><br/>', $f->execute());
- }
-}
diff --git a/vendor/fguillot/picofeed/tests/Filter/TagFilterTest.php b/vendor/fguillot/picofeed/tests/Filter/TagFilterTest.php
deleted file mode 100644
index 86911bbb4..000000000
--- a/vendor/fguillot/picofeed/tests/Filter/TagFilterTest.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-namespace PicoFeed\Filter;
-
-use PHPUnit_Framework_TestCase;
-
-
-class TagFilterTest extends PHPUnit_Framework_TestCase
-{
- public function testAllowedTag()
- {
- $tag = new Tag;
-
- $this->assertTrue($tag->isAllowed('p', array('class' => 'test')));
- $this->assertTrue($tag->isAllowed('img', array('class' => 'test')));
-
- $this->assertFalse($tag->isAllowed('script', array('class' => 'test')));
- $this->assertFalse($tag->isAllowed('img', array('width' => '1', 'height' => '1')));
- }
-
- public function testHtml()
- {
- $tag = new Tag;
-
- $this->assertEquals('<p>', $tag->openHtmlTag('p'));
- $this->assertEquals('<img src="test" alt="truc"/>', $tag->openHtmlTag('img', 'src="test" alt="truc"'));
- $this->assertEquals('<img/>', $tag->openHtmlTag('img'));
- $this->assertEquals('<br/>', $tag->openHtmlTag('br'));
-
- $this->assertEquals('</p>', $tag->closeHtmlTag('p'));
- $this->assertEquals('', $tag->closeHtmlTag('img'));
- $this->assertEquals('', $tag->closeHtmlTag('br'));
- }
-}