diff options
author | zotlabs <mike@macgirvin.com> | 2017-05-30 18:18:28 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-05-30 18:18:28 -0700 |
commit | d3cad5a651d32557d92457b347c0d67372d2482c (patch) | |
tree | 733ade8a68e6d39769468b1caaaa4a7282d9e6a5 /tests/unit/includes/TextTest.php | |
parent | 893ae17b99d1a1a720a58879e8075fc9bb1de087 (diff) | |
parent | 14229d0dd3205ea1e85d2c26d6c79bd68d19eda3 (diff) | |
download | volse-hubzilla-d3cad5a651d32557d92457b347c0d67372d2482c.tar.gz volse-hubzilla-d3cad5a651d32557d92457b347c0d67372d2482c.tar.bz2 volse-hubzilla-d3cad5a651d32557d92457b347c0d67372d2482c.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
Diffstat (limited to 'tests/unit/includes/TextTest.php')
-rw-r--r-- | tests/unit/includes/TextTest.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/includes/TextTest.php b/tests/unit/includes/TextTest.php index 25a997f7a..acc490001 100644 --- a/tests/unit/includes/TextTest.php +++ b/tests/unit/includes/TextTest.php @@ -11,6 +11,7 @@ use Zotlabs\Tests\Unit\UnitTestCase; */ class TextTest extends UnitTestCase { + public function testPurifyHTML() { // linebreaks $htmlbr = 'first line<br /> @@ -34,6 +35,9 @@ empty line above'; $this->assertEquals('<ul><li>item1</li></ul>', purify_html('<ul data-accordion-menu-unknown><li>item1</li></ul>')); } + /** + * @covers ::purify_html + */ public function testPurifyHTML_html() { $this->assertEquals('<div id="id01"><p class="class01">ids und classes</p></div>', purify_html('<div id="id01"><p class="class01">ids und classes</p></div>')); $this->assertEquals('<div><p>close missing tags</p></div>', purify_html('<div><p>close missing tags')); @@ -47,6 +51,9 @@ empty line above'; $this->assertEquals('', purify_html('<iframe width="560" height="315" src="https://www.youtube.com/embed/kiNGx5oL7hk" frameborder="0" allowfullscreen></iframe>')); } + /** + * @covers ::purify_html + */ public function testPurifyHTML_js() { $this->assertEquals('<div></div>', purify_html('<div><img src="javascript:evil();" onload="evil();"></div>')); $this->assertEquals('<a href="#">link</a>', purify_html('<a href="#" onclick="alert(\'xss\')">link</a>')); @@ -54,6 +61,9 @@ empty line above'; $this->assertEquals('', purify_html('<script>alter("42")</script>')); } + /** + * @covers ::purify_html + */ public function testPurifyHTML_css() { $this->assertEquals('<p style="color:#FF0000;background-color:#fff;">red</p>', purify_html('<p style="color:red; background-color:#fff">red</p>')); $this->assertEquals('<p>invalid color</p>', purify_html('<p style="color:invalid; background-color:#jjkkmm">invalid color</p>')); |