summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/core/Security_test.php
diff options
context:
space:
mode:
authorRoot <development@fractureme.com>2012-05-28 02:07:10 +0200
committerRoot <development@fractureme.com>2012-05-28 02:07:10 +0200
commite526c5a3c0c03088d9fb445d932973735d992ba3 (patch)
treefa041774010a82c3389949ec4677253df62ec23c /tests/codeigniter/core/Security_test.php
parent3cc8502b48946f7298797393cea0a7183c325244 (diff)
parent11fd4b8759438f216318e3e1e004f918b88a56ad (diff)
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into develop
Diffstat (limited to 'tests/codeigniter/core/Security_test.php')
-rw-r--r--tests/codeigniter/core/Security_test.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php
index 1796ba74d..b2f8c69d2 100644
--- a/tests/codeigniter/core/Security_test.php
+++ b/tests/codeigniter/core/Security_test.php
@@ -70,4 +70,36 @@ class Security_test extends CI_TestCase {
$this->assertEquals("Hello, i try to [removed]alert&#40;'Hack'&#41;;[removed] your site", $harmless_string);
}
+
+ // --------------------------------------------------------------------
+
+ public function test_xss_hash()
+ {
+ $this->assertEmpty($this->security->xss_hash);
+
+ // Perform hash
+ $this->security->xss_hash();
+
+ $this->assertTrue(preg_match('#^[0-9a-f]{32}$#iS', $this->security->xss_hash) === 1);
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_entity_decode()
+ {
+ $encoded = '&lt;div&gt;Hello &lt;b&gt;Booya&lt;/b&gt;&lt;/div&gt;';
+ $decoded = $this->security->entity_decode($encoded);
+
+ $this->assertEquals('<div>Hello <b>Booya</b></div>', $decoded);
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_sanitize_filename()
+ {
+ $filename = './<!--foo-->';
+ $safe_filename = $this->security->sanitize_filename($filename);
+
+ $this->assertEquals('foo', $safe_filename);
+ }
} \ No newline at end of file