diff options
Diffstat (limited to 'vendor/fguillot/picofeed/tests/Filter')
-rw-r--r-- | vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php | 62 |
1 files changed, 19 insertions, 43 deletions
diff --git a/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php b/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php index 5093855d1..8d64cbc1d 100644 --- a/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php +++ b/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php @@ -1,9 +1,9 @@ <?php + namespace PicoFeed\Filter; use PHPUnit_Framework_TestCase; - class HtmlFilterTest extends PHPUnit_Framework_TestCase { public function testExecute() @@ -31,6 +31,24 @@ class HtmlFilterTest extends PHPUnit_Framework_TestCase $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 @@ -124,46 +142,4 @@ x-amz-id-2: DDjqfqz2ZJufzqRAcj1mh+9XvSogrPohKHwXlo8IlkzH67G6w4wnjn9HYgbs4uI0 $f = new Html('<table><tr></tr></table>', 'http://blabla'); $this->assertEquals('', $f->execute()); } -/* - public function testFilter() - { - $input = <<<EOD -<div xmlns="http://www.w3.org/1999/xhtml"><article> -<figure> - <img src="/2014/08/06/4694-pluie" alt="Flaque de pluie"/> - <figcaption>La Saussaye, France, 6 août 2014</figcaption> -</figure> - -<div lang="en" class="extrait"> - <blockquote cite="urn:isbn:978-0-8248-3742-6"> - <p>Spring had truly arrived. Countless streams suddenly materialized all over the roads, fields, grasslands, and thickets; flowing as if the melting snow's waters were spilling over. </p> - </blockquote> - <p class="source"><span class="auteur">Takiji Kobayashi</span>, <cite class="titre">Yasuko</cite>.</p> -</div> - -<p>La pluie abonde. La forêt humide resplendit. L'eau monte, l'eau déborde. Il reste pourtant notre humanité. Toute entière, resplendissante.</p> - -</article> -</div> -EOD; - - $expected = <<<EOD -<figure> - <img src="http://www.la-grange.net/2014/08/06/4694-pluie" alt="Flaque de pluie"/> - <figcaption>La Saussaye, France, 6 août 2014</figcaption> -</figure> - - - <blockquote> - <p>Spring had truly arrived. Countless streams suddenly materialized all over the roads, fields, grasslands, and thickets; flowing as if the melting snow's waters were spilling over. </p> - </blockquote> - <p>Takiji Kobayashi, <cite>Yasuko</cite>.</p> - - -<p>La pluie abonde. La forêt humide resplendit. L'eau monte, l'eau déborde. Il reste pourtant notre humanité. Toute entière, resplendissante.</p> -EOD; - - $f = new Html($input, 'http://www.la-grange.net/'); - $this->assertEquals($expected, $f->execute()); - }*/ } |