diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-04-30 18:30:11 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-04-30 18:30:11 +0200 |
commit | eb28c3b137c8a0d61377087c9a04b820151b0b7c (patch) | |
tree | c1ebf149f43fa653a4ef1c3f33df04557094e834 /vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php | |
parent | 2e54780c1496bfa39cd035b9ac40ed851d2198f1 (diff) |
update deps
Diffstat (limited to 'vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php')
-rw-r--r-- | vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php b/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php index 03aeb33d5..9149e59bc 100644 --- a/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php +++ b/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php @@ -23,6 +23,22 @@ class HtmlFilterTest extends PHPUnit_Framework_TestCase $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 – The Cookie">' . + '<img src="http://www.twogag.com/comics-rss/2015-04-17-TGAG_559_The_Cookie.jpg" alt="559 – The Cookie" class="comicthumbnail" 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!'; + + $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>'; @@ -148,4 +164,10 @@ x-amz-id-2: DDjqfqz2ZJufzqRAcj1mh+9XvSogrPohKHwXlo8IlkzH67G6w4wnjn9HYgbs4uI0 $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()); + } } |