summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/core
diff options
context:
space:
mode:
authorTaufan Aditya <toopay@taufanaditya.com>2012-05-27 08:51:27 +0200
committerTaufan Aditya <toopay@taufanaditya.com>2012-05-27 08:51:27 +0200
commit6c7526c95b3fbd502dc8105a67fd38da793caa4e (patch)
tree5e3ec6bbccd6105cb993601f0c4356374e3cb2dd /tests/codeigniter/core
parent650f2a2bc15dd575f50446dcc1315c131652ca49 (diff)
Continuation for Security and Table code-coverage, add coverage report to travis
Diffstat (limited to 'tests/codeigniter/core')
-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