This file is indexed.

/usr/share/php/kohana3.1/system/tests/kohana/Http/Header/ValueTest.php is in libkohana3.1-core-php 3.1.4-2.

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
162
163
164
<?php defined('SYSPATH') OR die('Kohana bootstrap needs to be included before tests run');

/**
 * Unit tests for Kohana_HTTP_Header_Value
 *
 * @group kohana
 * @group kohana.http
 * @group kohana.http.header
 * @group kohana.http.header.value
 *
 * @see CLI
 * @package    Kohana
 * @category   Tests
 * @author     Kohana Team
 * @author     BRMatt <matthew@sigswitch.com>
 * @copyright  (c) 2008-2011 Kohana Team
 * @license    http://kohanaphp.com/license
 */
class Kohana_HTTP_Header_ValueTest extends Unittest_TestCase
{
	/**
	 * If the header value is composed of a key value pair then the parser
	 * should return an array of key => value
	 *
	 * @test
	 */
	public function test_parser_returns_array_if_header_contains_key_val()
	{
		$key_val = Kohana_HTTP_Header_Value::parse_key_value('name=kohana');
		$this->assertSame(array('name' => 'kohana'), $key_val);
	}

	/**
	 * If the parser is passed a header which doesn't contain a key then it should
	 * return the header key as a string
	 *
	 * @test
	 * @covers Kohana_HTTP_Header_Value::parse_key_value
	 */
	public function test_parser_returns_key_as_array_if_value_isnt_present()
	{
		$this->assertSame(
			array('kohana'),
			Kohana_HTTP_Header_Value::parse_key_value('kohana')
		);
	}

	/**
	 * Provides test data for test_parsing_only_splits_on_first_separator()
	 *
	 * @return array
	 */
	public function provider_test_parsing_only_splits_on_first_separator()
	{
		return array(
			array('='),
			array('+')
		);
	}

	/**
	 * If we pass in a string containing multiple occurences of the separator then
	 * the string should only be split on the first occurence
	 *
	 * @test
	 * @dataProvider provider_test_parsing_only_splits_on_first_separator
	 * @covers Kohana_HTTP_Header_Value::parse_key_value
	 */
	public function test_parsing_only_splits_on_first_separator($separator)
	{
		$key = 'some_value';
		$val = 'pie,pizza'.$separator.'cheese';

		$key_value = Kohana_HTTP_Header_Value::parse_key_value($key.$separator.$val, $separator);

		$this->assertSame(array($key => $val), $key_value);
	}

	/**
	 * Provides test data
	 *
	 * @return array
	 */
	public function provider_constructor_throws_exception_if_header_value_type_not_allowed()
	{
		return array(
			array(42),
			array(new ArrayObject),
		);
	}
	/**
	 * If the constructor is passed a value of type other than string|array then it should
	 * throw a HTTP_Exception_500
	 *
	 * @test
	 * @dataProvider provider_constructor_throws_exception_if_header_value_type_not_allowed
	 * @expectedException HTTP_Exception_500
	 * @param mixed The header value to pass to the constructor
	 */
	public function test_constructor_throws_exception_if_header_value_type_not_allowed($header)
	{
		new Kohana_HTTP_Header_Value($header);
	}

	/**
	 * When the constructor is passed an array of values it should extract the appropriate values
	 * and set them in the object's properties
	 *
	 * @test
	 * @covers Kohana_HTTP_Header_Value
	 */
	public function test_constructor_allows_and_parses_header_in_array_format()
	{
		$input = array(
			'key'        => 'name',
			'value'      => 'kohana',
			'properties' => array(
				'ttl' => '60'
			)
		);
		$header = new Kohana_HTTP_Header_Value($input);

		$this->assertSame($input['key'],        $header->key);
		$this->assertSame($input['value'],      $header->value);
		$this->assertSame($input['properties'], $header->properties);
	}

	/**
	 * Provides test data
	 *
	 * @return array
	 */
	public function provider_compiles_down_to_valid_header_when_cast_to_string()
	{
		return array(
			// Basic test, try and achieve what the doccomment says it can do
			array(
				'name=value; property; another_property=property_value',
				array(
					'key'  => 'name',
					'value' => 'value',
					'properties' => array('property', 'another_property' => 'property_value')
				),
			),
		);
	}

	/**
	 * When we cast a Kohana_HTTP_Header_Value object to a string it should generate
	 * a valid header
	 *
	 * @test
	 * @covers Kohana_HTTP_Header_Value::__toString
	 * @dataProvider provider_compiles_down_to_valid_header_when_cast_to_string
	 * @param string       Expected compiled header
	 * @param array|string The compiled header
	 */
	public function test_compiles_down_to_valid_header_when_cast_to_string($expected, $input)
	{
		$header = new Kohana_HTTP_Header_Value($input);

		$this->assertSame($expected, (string) $header);
	}
}