diff options
author | zotlabs <mike@macgirvin.com> | 2017-11-04 18:18:56 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-11-04 18:18:56 -0700 |
commit | 65bc146afa82f3f0f2e3921660189892af42c15b (patch) | |
tree | afbe430a72f01a2ba02b05f4587cf42196c6a136 /tests/unit/includes/TextTest.php | |
parent | 9630d2ef2c042c5531bf3a553317ae3bd115f3dc (diff) | |
parent | 6995d54a3cc162d87f881f6e206fa356230fd9e8 (diff) | |
download | volse-hubzilla-65bc146afa82f3f0f2e3921660189892af42c15b.tar.gz volse-hubzilla-65bc146afa82f3f0f2e3921660189892af42c15b.tar.bz2 volse-hubzilla-65bc146afa82f3f0f2e3921660189892af42c15b.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 | 40 |
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 >' => ['>', '>'] + ]; + } + + /** + * @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); + } + } |