123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- class TestSecurity extends UnitTestCase
- {
- public $clean = array();
- public function __construct()
- {
- $this->UnitTestCase('Security library - main/inc/lib/security.lib.test.php');
- }
- function testcheck_abs_path()
- {
- $abs_path = '';
- $checker_path = '';
- $res = Security::check_abs_path($abs_path, $checker_path);
- $this->assertTrue(is_bool($res));
-
- }
- function testcheck_rel_path()
- {
- $rel_path = '';
- $checker_path = '';
- $res = Security::check_rel_path($rel_path, $checker_path);
- $this->assertTrue(is_bool($res));
-
- }
- function testcheck_token()
- {
- $res = Security::check_token();
- $this->assertTrue(is_bool($res));
-
- }
- function testcheck_ua()
- {
- $res = Security::check_ua();
- $this->assertTrue(is_bool($res));
-
- }
- function testclear_token()
- {
- $res = Security::clear_token();
- $this->assertTrue(is_null($res));
-
- }
- function testfilter_filename()
- {
- $filename = 'security/.htaccess';
- $res = Security::filter_filename($filename);
- $this->assertTrue(is_string($res));
-
- }
- function testget()
- {
- $varname = '';
- $res = Security::get($varname);
- if (!empty($res)) {
- $this->assertTrue(is_string($res));
- } else {
- $this->assertTrue(is_null($res));
- }
-
- }
- function testget_HTML_token()
- {
- $res = Security::get_HTML_token();
- $this->assertTrue(is_string($res));
-
- }
- function testget_token()
- {
- $res = Security::get_token();
- $this->assertTrue(is_string($res));
-
- }
- function testget_ua()
- {
- $res = Security::get_ua();
- $this->assertTrue(is_null($res));
-
- }
- function testremove_XSS()
- {
- global $charset;
- $var = '';
- $user_status = ANONYMOUS;
- $res = Security::remove_XSS($var, $user_status = ANONYMOUS);
- if (!empty($res)) {
- $this->assertTrue(is_array($res));
- } else {
- $this->assertTrue(is_string($res));
- }
-
- }
- }
- ?>
|