/usr/share/php/kohana3.1/system/tests/kohana/Http/HeaderTest.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 | <?php defined('SYSPATH') OR die('No direct script access.');
/**
* Unit Tests for Kohana_HTTP_Header
*
* @group kohana
* @group kohana.core
* @group kohana.core.http
* @group kohana.core.http.header
* @group kohana.core.http.header
*
* @package Kohana
* @category Tests
* @author Kohana Team
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaphp.com/license
*/
class Kohana_HTTP_HeaderTest extends Unittest_TestCase {
/**
* Provides test data for test_parse_header_values()
*
* @return array
*/
public function provider_parse_header_values()
{
return array(
array(
array(
'Date' => 'Sun, 13 Mar 2011 16:02:19 GMT',
'Expires' => '-1',
'Cache-Control' => 'private, max-age=0',
'Content-Type' => 'text/html; charset=ISO-8859-1',
'Server' => 'Apache'
),
array(
'date' => new HTTP_Header_Value('Sun, 13 Mar 2011 16:02:19 GMT'),
'expires' => new HTTP_Header_Value('-1'),
'cache-control' => array(new HTTP_Header_Value('private'), 'max-age' => new HTTP_Header_Value('max-age=0')),
'content-type' => new HTTP_Header_Value('text/html; charset=ISO-8859-1'),
'server' => new HTTP_Header_Value('Apache')
)
),
array(
array(
'Date' => 'Sun, 13 Mar 2011 16:02:19 GMT',
'Expires' => '-1',
'Cache-Control' => 'private, max-age=0',
'Content-Type' => 'text/html; charset=ISO-8859-1',
'Server' => 'Apache',
'Set-Cookie' => array(
'PREF=ID=dbfa7be8975d02f9:FF=0:TM=1300032139:LM=1300032139:S=ufhpKoOHVm55WY6v; expires=Tue, 12-Mar-2013 16:02:19 GMT; path=/; domain=.google.co.uk',
'NID=44=CxNpOQbQ7fFoxIDZWRHQJaKXgZvi76heU9OfsVi75gUH2Ik0p6tAuqW9AmTwvsE1oy0XBHDgIgMq-301hvAiyHC1sgI71pKcMUEf5VCRvCwHxJH9ZR-tlJdDD-df1vnz; expires=Mon, 12-Sep-2011 16:02:19 GMT; path=/; domain=.google.co.uk; HttpOnly'
)
),
array(
'date' => new HTTP_Header_Value('Sun, 13 Mar 2011 16:02:19 GMT'),
'expires' => new HTTP_Header_Value('-1'),
'cache-control' => array(
new HTTP_Header_Value('private'),
'max-age' => new HTTP_Header_Value('max-age=0'
)),
'content-type' => new HTTP_Header_Value('text/html; charset=ISO-8859-1'),
'server' => new HTTP_Header_Value('Apache'),
'set-cookie' => array(
new HTTP_Header_Value(array(
'key' => 'PREF',
'value' => 'ID=dbfa7be8975d02f9:FF=0:TM=1300032139:LM=1300032139:S=ufhpKoOHVm55WY6v',
'properties' => array(
'expires' => 'Tue, 12-Mar-2013 16:02:19 GMT',
'path' => '/',
'domain' => '.google.co.uk'
)
)),
new HTTP_Header_Value(array(
'key' => 'NID',
'value' => '44=CxNpOQbQ7fFoxIDZWRHQJaKXgZvi76heU9OfsVi75gUH2Ik0p6tAuqW9AmTwvsE1oy0XBHDgIgMq-301hvAiyHC1sgI71pKcMUEf5VCRvCwHxJH9ZR-tlJdDD-df1vnz',
'properties' => array(
'expires' => 'Mon, 12-Sep-2011 16:02:19 GMT',
'path' => '/',
'domain' => '.google.co.uk',
'HttpOnly'
)
))
)
)
),
);
}
/**
* Tests the parse_header_values() method.
*
* @dataProvider provider_parse_header_values
*
* @param array header array to parse
* @param array expected result
* @return void
*/
public function test_parse_header_values($header_array, $expected)
{
$header = HTTP_Header::parse_header_values($header_array);
// Test the correct type is returned
$this->assertTrue(is_array($header));
foreach ($header as $key => $value)
{
if ($value instanceof HTTP_Header_Value)
{
$this->assertSame($value->value(), $expected[$key]->value());
$this->assertSame($value->key(), $expected[$key]->key());
$this->assertSame($value->properties(), $expected[$key]->properties());
}
elseif (is_array($value))
{
foreach ($value as $k => $v)
{
$this->assertSame($v->value(), $expected[$key][$k]->value());
$this->assertSame($v->key(), $expected[$key][$k]->key());
$this->assertSame($v->properties(), $expected[$key][$k]->properties());
}
}
else
{
$this->fail('Unexpected value in HTTP_Header::parse_header_values() return value.');
}
}
}
} // End Kohana_HTTP_HeaderTest
|