This file is indexed.

/usr/share/php/kohana3.1/system/tests/kohana/CookieTest.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
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php defined('SYSPATH') OR die('Kohana bootstrap needs to be included before tests run');

/**
 * Tests the cookie class
 *
 * @group kohana
 * @group kohana.core
 * @group kohana.core.cookie
 *
 * @package    Kohana
 * @category   Tests
 * @author     Kohana Team
 * @author     Jeremy Bush <contractfrombelow@gmail.com>
 * @copyright  (c) 2008-2012 Kohana Team
 * @license    http://kohanaframework.org/license
 */
class Kohana_CookieTest extends Unittest_TestCase
{

	protected $_default_salt = 'AdaoidadnA£ASDNadnaoiwdnawd';
	/**
	 * Sets up the environment
	 */
	public function setUp()
	{
		parent::setUp();

		Cookie::$salt = $this->_default_salt;
	}

	/**
	 * Tears down the environment
	 */
	public function tearDown()
	{
		parent::tearDown();

		Cookie::$salt = NULL;
	}

	/**
	 * Provides test data for test_set()
	 *
	 * @return array
	 */
	public function provider_set()
	{
		return array(
			array('foo', 'bar', NULL, TRUE),
			array('foo', 'bar', 10, TRUE),
		);
	}

	/**
	 * Tests cookie::set()
	 *
	 * @test
	 * @dataProvider provider_set
	 * @covers cookie::set
	 * @param mixed   $key      key to use
	 * @param mixed   $value    value to set
	 * @param mixed   $exp      exp to set
	 * @param boolean $expected Output for cookie::set()
	 */
	public function test_set($key, $value, $exp, $expected)
	{
		$this->assertSame($expected, cookie::set($key, $value, $exp));
	}

	/**
	 * Provides test data for test_get()
	 *
	 * @return array
	 */
	public function provider_get()
	{
		// setUp is called after the provider so we need to specify a
		// salt here in order to use it in the provider
		Cookie::$salt = $this->_default_salt;

		return array(
			array('foo', Cookie::salt('foo', 'bar').'~bar', 'bar'),
			array('bar', Cookie::salt('foo', 'bar').'~bar', NULL),
			array(NULL, Cookie::salt('foo', 'bar').'~bar', NULL),
		);
	}

	/**
	 * Tests cookie::set()
	 *
	 * @test
	 * @dataProvider provider_get
	 * @covers cookie::get
	 * @param mixed   $key      key to use
	 * @param mixed   $value    value to set
	 * @param boolean $expected Output for cookie::get()
	 */
	public function test_get($key, $value, $expected)
	{
		// Force $_COOKIE
		if ($key !== NULL)
		{
			$_COOKIE[$key] = $value;
		}

		$this->assertSame($expected, cookie::get($key));
	}

	/**
	 * Provides test data for test_delete()
	 *
	 * @return array
	 */
	public function provider_delete()
	{
		return array(
			array('foo', TRUE),
		);
	}

	/**
	 * Tests cookie::delete()
	 *
	 * @test
	 * @dataProvider provider_delete
	 * @covers cookie::delete
	 * @param mixed   $key      key to use
	 * @param boolean $expected Output for cookie::delete()
	 */
	public function test_delete($key, $expected)
	{
		$this->assertSame($expected, cookie::delete($key));
	}

	/**
	 * Provides test data for test_salt()
	 *
	 * @return array
	 */
	public function provider_salt()
	{
		return array(
			array('foo', 'bar', 'b5773a6255d1deefc23f9f69bcc40fdc998e5802'),
		);
	}

	/**
	 * Tests cookie::salt()
	 *
	 * @test
	 * @dataProvider provider_salt
	 * @covers cookie::salt
	 * @param mixed   $key      key to use
	 * @param mixed   $value    value to salt with
	 * @param boolean $expected Output for cookie::delete()
	 */
	public function test_salt($key, $value, $expected)
	{
		$this->assertSame($expected, cookie::salt($key, $value));
	}
}