From 21cd4a1b4845858c3421dbd5f2673eceee421f5d Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 26 Nov 2020 08:43:03 +0000 Subject: psr-4 autoloading standard --- tests/unit/includes/TextTest.php | 120 --------------------------------------- 1 file changed, 120 deletions(-) delete mode 100644 tests/unit/includes/TextTest.php (limited to 'tests/unit/includes/TextTest.php') diff --git a/tests/unit/includes/TextTest.php b/tests/unit/includes/TextTest.php deleted file mode 100644 index 97fa64895..000000000 --- a/tests/unit/includes/TextTest.php +++ /dev/null @@ -1,120 +0,0 @@ - - one tab preserved - -empty line above'; - $this->assertEquals($htmlbr, purify_html($htmlbr)); - - // HTML5 is not supported by HTMLPurifier yet, test our own configuration - $html5elements = '
section
'; - $this->assertEquals($html5elements, purify_html($html5elements)); - $this->assertEquals('', purify_html('')); - - // unsupported HTML5 elements - $this->assertEquals('Your HTML parser does not support HTML5 video.', purify_html('')); - $this->assertEquals('Your HTML parser does not support HTML5 audio.', purify_html('')); - - // preserve f6 and bootstrap additional data attributes from our own configuration - $this->assertEquals('
text
', purify_html('
text
')); - $this->assertEquals('', purify_html('')); - $this->assertEquals('', purify_html('')); - } - - /** - * @covers ::purify_html - */ - public function testPurifyHTML_html() { - $this->assertEquals('

ids und classes

', purify_html('

ids und classes

')); - $this->assertEquals('

close missing tags

', purify_html('

close missing tags')); - $this->assertEquals('

deprecated tag
', purify_html('
deprecated tag
')); - $this->assertEquals('
illegal nesting
', purify_html('
illegal nesting
')); - $this->assertEquals('link with target', purify_html('link with target')); - $this->assertEquals('link with rel="nofollow"', purify_html('link with rel="nofollow"')); - $this->assertEquals('a b', purify_html('a b')); - $this->assertEquals('ä ä € €', purify_html('ä ä € €')); - $this->assertEquals('text', purify_html('text')); - $this->assertEquals('', purify_html('')); - } - - /** - * @covers ::purify_html - */ - public function testPurifyHTML_js() { - $this->assertEquals('
', purify_html('
')); - $this->assertEquals('link', purify_html('link')); - $this->assertEquals('', purify_html('')); - $this->assertEquals('', purify_html('')); - } - - /** - * @covers ::purify_html - */ - public function testPurifyHTML_css() { - $this->assertEquals('

red

', purify_html('

red

')); - $this->assertEquals('

invalid color

', purify_html('

invalid color

')); - $this->assertEquals('

invalid style

', purify_html('

invalid style

')); - - // test our own CSS configuration - $this->assertEquals('
position removed
', purify_html('
position removed
')); - $this->assertEquals('
position preserved
', purify_html('
position preserved
', true)); - $this->assertEquals('
invalid position removed
', purify_html('
invalid position removed
', true)); - - $this->assertEquals('
position removed
', purify_html('
position removed
')); - $this->assertEquals('
position preserved
', purify_html('
position preserved
', true)); - $this->assertEquals('
invalid position removed
', purify_html('
invalid position removed
', true)); - } - - /** - * @dataProvider notagsProvider - */ - public function testNotags($string, $expected) { - $this->assertEquals($expected, notags($string)); - } - public function notagsProvider() { - return [ - 'empty string' => ['', ''], - 'simple tag' => ['', '[value]'], - 'tag pair' => ['text', '[b]text[/b]'], - 'double angle bracket' => ['< ['>', '>'] - ]; - } - - /** - * @dataProvider sanitise_aclProvider - */ - public function testSanitise_acl($string, $expected) { - sanitise_acl($string); - $this->assertEquals($expected, $string); - } - public function sanitise_aclProvider() { - return [ - 'text' => ['value', ''], - 'text with angle bracket' => ['', '<[value]>'], - 'comma separated acls' => ['value1,value2', ''] - ]; - } - - public function testUnsetSanitise_acl() { - $empty = ''; - sanitise_acl($empty); - $this->assertTrue(isset($empty)); // unset() not working? Would expect false - $this->assertEmpty($empty); - } - -} -- cgit v1.2.3