ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
GetAllHeadersTest.php
Go to the documentation of this file.
1
<?
php
2
3
class
GetAllHeadersTest
extends
\PHPUnit_Framework_TestCase
4
{
5
9
public
function
testWorks
($test_type, $expected,
$server
)
10
{
11
foreach
(
$server
as
$key
=> $val) {
12
$_SERVER
[
$key
] = $val;
13
}
14
$result
= getallheaders();
15
$this->assertEquals($expected,
$result
,
"Error testing $test_type works."
);
16
}
17
18
public
function
testWorksData
()
19
{
20
return
array(
21
array(
22
'normal case'
,
23
array(
24
'Key-One'
=>
'foo'
,
25
'Key-Two'
=>
'bar'
,
26
'Another-Key-For-Testing'
=>
'baz'
27
),
28
array(
29
'HTTP_KEY_ONE'
=>
'foo'
,
30
'HTTP_KEY_TWO'
=>
'bar'
,
31
'HTTP_ANOTHER_KEY_FOR_TESTING'
=>
'baz'
32
)
33
),
34
array(
35
'Content-Type'
,
36
array(
37
'Content-Type'
=>
'two'
38
),
39
array(
40
'HTTP_CONTENT_TYPE'
=>
'one'
,
41
'CONTENT_TYPE'
=>
'two'
42
)
43
),
44
array(
45
'Content-Length'
,
46
array(
47
'Content-Length'
=>
'222'
48
),
49
array(
50
'CONTENT_LENGTH'
=>
'222'
,
51
'HTTP_CONTENT_LENGTH'
=>
'111'
52
)
53
),
54
array(
55
'Content-Length (HTTP_CONTENT_LENGTH only)'
,
56
array(
57
'Content-Length'
=>
'111'
58
),
59
array(
60
'HTTP_CONTENT_LENGTH'
=>
'111'
61
)
62
),
63
array(
64
'Content-MD5'
,
65
array(
66
'Content-Md5'
=>
'aef123'
67
),
68
array(
69
'CONTENT_MD5'
=>
'aef123'
,
70
'HTTP_CONTENT_MD5'
=>
'fea321'
71
)
72
),
73
array(
74
'Content-MD5 (HTTP_CONTENT_MD5 only)'
,
75
array(
76
'Content-Md5'
=>
'f123'
77
),
78
array(
79
'HTTP_CONTENT_MD5'
=>
'f123'
80
)
81
),
82
array(
83
'Authorization (normal)'
,
84
array(
85
'Authorization'
=>
'testing'
86
),
87
array(
88
'HTTP_AUTHORIZATION'
=>
'testing'
,
89
)
90
),
91
array(
92
'Authorization (redirect)'
,
93
array(
94
'Authorization'
=>
'testing redirect'
95
),
96
array(
97
'REDIRECT_HTTP_AUTHORIZATION'
=>
'testing redirect'
,
98
)
99
),
100
array(
101
'Authorization (PHP_AUTH_USER + PHP_AUTH_PW)'
,
102
array(
103
'Authorization'
=>
'Basic '
. base64_encode(
'foo:bar'
)
104
),
105
array(
106
'PHP_AUTH_USER'
=>
'foo'
,
107
'PHP_AUTH_PW'
=>
'bar'
108
)
109
),
110
array(
111
'Authorization (PHP_AUTH_DIGEST)'
,
112
array(
113
'Authorization'
=>
'example-digest'
114
),
115
array(
116
'PHP_AUTH_DIGEST'
=>
'example-digest'
117
)
118
)
119
);
120
}
121
}
$_SERVER
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
Definition:
tcpdf_autoconfig.php:54
$result
$result
Definition:
CleanUpTest.php:463
PHPUnit_Framework_TestCase
$server
$server
Definition:
sabredav.php:48
GetAllHeadersTest
Definition:
GetAllHeadersTest.php:3
GetAllHeadersTest\testWorks
testWorks($test_type, $expected, $server)
testWorksData
Definition:
GetAllHeadersTest.php:9
GetAllHeadersTest\testWorksData
testWorksData()
Definition:
GetAllHeadersTest.php:18
php
$key
$key
Definition:
croninfo.php:18
libs
composer
vendor
ralouphie
getallheaders
tests
GetAllHeadersTest.php
Generated on Thu Jan 30 2025 19:01:25 for ILIAS by
1.8.13 (using
Doxyfile
)