/usr/share/php/kohana3.1/system/tests/kohana/SecurityTest.php is in libkohana3.1-core-php 3.1.5-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | <?php defined('SYSPATH') OR die('Kohana bootstrap needs to be included before tests run');
/**
* Tests Kohana_Security
*
* @group kohana
* @group kohana.core
* @group kohana.core.security
*
* @package Kohana
* @category Tests
*/
class Kohana_SecurityTest extends Unittest_TestCase
{
/**
* Provides test data for test_envode_php_tags()
*
* @return array Test data sets
*/
public function provider_encode_php_tags()
{
return array(
array("<?php echo 'helloo'; ?>", "<?php echo 'helloo'; ?>"),
);
}
/**
* Tests Security::encode_php_tags()
*
* @test
* @dataProvider provider_encode_php_tags
* @covers Security::encode_php_tags
*/
public function test_encode_php_tags($expected, $input)
{
$this->assertSame($expected, Security::encode_php_tags($input));
}
/**
* Provides test data for test_strip_image_tags()
*
* @return array Test data sets
*/
public function provider_strip_image_tags()
{
return array(
array('foo', '<img src="foo" />'),
);
}
/**
* Tests Security::strip_image_tags()
*
* @test
* @dataProvider provider_strip_image_tags
* @covers Security::strip_image_tags
*/
public function test_strip_image_tags($expected, $input)
{
$this->assertSame($expected, Security::strip_image_tags($input));
}
/**
* Provides test data for Security::token()
*
* @return array Test data sets
*/
public function provider_csrf_token()
{
$array = array();
for ($i = 0; $i <= 4; $i++)
{
Security::$token_name = 'token_'.$i;
$array[] = array(Security::token(TRUE), Security::check(Security::token(FALSE)), $i);
}
return $array;
}
/**
* Tests Security::token()
*
* @test
* @dataProvider provider_csrf_token
* @covers Security::token
*/
public function test_csrf_token($expected, $input, $iteration)
{
Security::$token_name = 'token_'.$iteration;
$this->assertSame(TRUE, $input);
$this->assertSame($expected, Security::token(FALSE));
Session::instance()->delete(Security::$token_name);
}
}
|