aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/includes/TextTest.php
diff options
context:
space:
mode:
authorgit-marijus <mario@mariovavti.com>2017-11-04 10:22:58 +0100
committerGitHub <noreply@github.com>2017-11-04 10:22:58 +0100
commitcfbeb1655daba511f4843b8ba070a247e233fb29 (patch)
tree8ef7bf1e06a5d223228b370121bda97695af7d0e /tests/unit/includes/TextTest.php
parent1a737be2b408135177a9e94dcffd0f68c0aca90b (diff)
parent39c194c5c32e49f461b8b42a3f4e411a3a5cde3c (diff)
downloadvolse-hubzilla-cfbeb1655daba511f4843b8ba070a247e233fb29.tar.gz
volse-hubzilla-cfbeb1655daba511f4843b8ba070a247e233fb29.tar.bz2
volse-hubzilla-cfbeb1655daba511f4843b8ba070a247e233fb29.zip
Merge branch 'dev' into docu
Diffstat (limited to 'tests/unit/includes/TextTest.php')
-rw-r--r--tests/unit/includes/TextTest.php40
1 files changed, 39 insertions, 1 deletions
diff --git a/tests/unit/includes/TextTest.php b/tests/unit/includes/TextTest.php
index acc490001..97fa64895 100644
--- a/tests/unit/includes/TextTest.php
+++ b/tests/unit/includes/TextTest.php
@@ -5,7 +5,7 @@ namespace Zotlabs\Tests\Unit\includes;
use Zotlabs\Tests\Unit\UnitTestCase;
/**
- * @brief Unit Test case for include/texter.php file.
+ * @brief Unit Test case for include/text.php file.
*
* @author ken restivo
*/
@@ -79,4 +79,42 @@ empty line above';
$this->assertEquals('<div>invalid position removed</div>', purify_html('<div style="top:10p">invalid position removed</div>', true));
}
+ /**
+ * @dataProvider notagsProvider
+ */
+ public function testNotags($string, $expected) {
+ $this->assertEquals($expected, notags($string));
+ }
+ public function notagsProvider() {
+ return [
+ 'empty string' => ['', ''],
+ 'simple tag' => ['<value>', '[value]'],
+ 'tag pair' => ['<b>text</b>', '[b]text[/b]'],
+ 'double angle bracket' => ['<<value', '[[value'],
+ 'HTML entity &gt;' => ['&gt;', '&gt;']
+ ];
+ }
+
+ /**
+ * @dataProvider sanitise_aclProvider
+ */
+ public function testSanitise_acl($string, $expected) {
+ sanitise_acl($string);
+ $this->assertEquals($expected, $string);
+ }
+ public function sanitise_aclProvider() {
+ return [
+ 'text' => ['value', '<value>'],
+ 'text with angle bracket' => ['<value>', '<[value]>'],
+ 'comma separated acls' => ['value1,value2', '<value1,value2>']
+ ];
+ }
+
+ public function testUnsetSanitise_acl() {
+ $empty = '';
+ sanitise_acl($empty);
+ $this->assertTrue(isset($empty)); // unset() not working? Would expect false
+ $this->assertEmpty($empty);
+ }
+
}