aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/includes/TextTest.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-08-16 10:32:35 +0200
committerMario Vavti <mario@mariovavti.com>2017-08-16 10:32:35 +0200
commit4a7384bc0ce1893a432bf4b7d67bca23796fe9db (patch)
tree5623c66a3f66445284529d6207e4ab4a2edb2810 /tests/unit/includes/TextTest.php
parentc664a4bdcd1bd578f5ec3c2884f7c97e9f68d2d7 (diff)
parent90bc21f2d560d879d7eaf05a85af6d6dca53ebac (diff)
downloadvolse-hubzilla-4a7384bc0ce1893a432bf4b7d67bca23796fe9db.tar.gz
volse-hubzilla-4a7384bc0ce1893a432bf4b7d67bca23796fe9db.tar.bz2
volse-hubzilla-4a7384bc0ce1893a432bf4b7d67bca23796fe9db.zip
Merge branch '2.6RC'2.6
Diffstat (limited to 'tests/unit/includes/TextTest.php')
-rw-r--r--tests/unit/includes/TextTest.php20
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/unit/includes/TextTest.php b/tests/unit/includes/TextTest.php
index e2c7cbb9a..acc490001 100644
--- a/tests/unit/includes/TextTest.php
+++ b/tests/unit/includes/TextTest.php
@@ -11,17 +11,6 @@ use Zotlabs\Tests\Unit\UnitTestCase;
*/
class TextTest extends UnitTestCase {
- public function testGoodEmail() {
- $this->assertTrue(valid_email_regex('ken@spaz.org'));
- $this->assertTrue(valid_email_regex('ken@restivo.org'));
- $this->assertTrue(valid_email_regex('nobody@hubzilla.org'));
- $this->assertTrue(valid_email_regex('foo+nobody@hubzilla.org'));
- }
-
- public function testBadEmail() {
- $this->assertFalse(valid_email_regex('nobody!uses!these!any.more'));
- $this->assertFalse(valid_email_regex('foo@bar@hubzilla.org'));
- }
public function testPurifyHTML() {
// linebreaks
@@ -46,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'));
@@ -59,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>'));
@@ -66,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>'));