diff options
author | Andrey Andreev <narf@devilix.net> | 2018-01-13 12:57:11 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2018-01-13 12:57:11 +0100 |
commit | 02a0518e1c56ba3506f370362ac5ebdb8a138312 (patch) | |
tree | 8b4684192b403dcae17d298eb4fc9e7ab001acad /tests/codeigniter/helpers/security_helper_test.php | |
parent | f0b9735d5857e6c07c8f5824b13cff4828db3cfe (diff) |
[ci skip] 3.1.7 release
Diffstat (limited to 'tests/codeigniter/helpers/security_helper_test.php')
-rw-r--r-- | tests/codeigniter/helpers/security_helper_test.php | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/tests/codeigniter/helpers/security_helper_test.php b/tests/codeigniter/helpers/security_helper_test.php deleted file mode 100644 index effd3ec02..000000000 --- a/tests/codeigniter/helpers/security_helper_test.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -class Security_helper_tests extends CI_TestCase { - - function setUp() - { - $this->helper('security'); - $obj = new stdClass; - $obj->security = new Mock_Core_Security(); - $this->ci_instance($obj); - } - - function test_xss_clean() - { - $this->assertEquals('foo', xss_clean('foo')); - - $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", xss_clean("Hello, i try to <script>alert('Hack');</script> your site")); - } - - function test_sanitize_filename() - { - $this->assertEquals('hello.doc', sanitize_filename('hello.doc')); - - $filename = './<!--foo-->'; - $this->assertEquals('foo', sanitize_filename($filename)); - } - - function test_do_hash() - { - $md5 = md5('foo'); - $sha1 = sha1('foo'); - - $algos = hash_algos(); - $algo_results = array(); - foreach ($algos as $k => $v) - { - $algo_results[$v] = hash($v, 'foo'); - } - - $this->assertEquals($sha1, do_hash('foo')); - $this->assertEquals($sha1, do_hash('foo', 'sha1')); - $this->assertEquals($md5, do_hash('foo', 'md5')); - $this->assertEquals($md5, do_hash('foo', 'foobar')); - - // Test each algorithm available to PHP - foreach ($algo_results as $algo => $result) - { - $this->assertEquals($result, do_hash('foo', $algo)); - } - } - - function test_strip_image_tags() - { - $this->assertEquals('http://example.com/spacer.gif', strip_image_tags('http://example.com/spacer.gif')); - - $this->assertEquals('http://example.com/spacer.gif', strip_image_tags('<img src="http://example.com/spacer.gif" alt="Who needs CSS when you have a spacer.gif?" />')); - } - - function test_encode_php_tags() - { - $this->assertEquals('<? echo $foo; ?>', encode_php_tags('<? echo $foo; ?>')); - } - -}
\ No newline at end of file |