forked from laruence/yaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
072.phpt
92 lines (83 loc) · 2 KB
/
072.phpt
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
--TEST--
check for Yaf_Response_Http::setHeader() and Yaf_Response_Http::getHeader()
and Yaf_Response_Http::setAllHeaders() and Yaf_Response_Http::clearHeaders()
--SKIPIF--
<?php if (!extension_loaded("yaf")) print "skip"; ?>
--INI--
yaf.use_namespace=0
--FILE--
<?php
$response = new Yaf_Response_Http();
var_dump($response->setHeader('MyName1', 'Header1'));
var_dump($response->setHeader('MyName2', 'Header2'));
var_dump($response->setHeader('MyName2', 'Header22'));
var_dump($response->setHeader('MyName1', 'Header11', false));
print_r($response);
var_dump($response->setHeader('MyName1', 'Header1'));
var_dump($response->setHeader('MyName3', 'Header31', false, 301));
var_dump($response->setHeader('MyName3', 'Header32', true, 302));
var_dump($response->setHeader('MyName1', 'Header2', false, 302));
var_dump($response->getHeader());
var_dump($response->getHeader('MyName'));
var_dump($response->getHeader('MyName1'));
print_r($response->clearHeaders());
$headers = array(
'MyName1' => 'Header1x',
'MyName2' => 'Header2x',
'MyName3' => 12345
);
var_dump($response->setAllHeaders($headers));
var_dump($response->getHeader());
?>
--EXPECTF--
bool(true)
bool(true)
bool(true)
bool(true)
Yaf_Response_Http Object
(
[_header:protected] => Array
(
[MyName1] => Header1, Header11
[MyName2] => Header22
)
[_body:protected] => Array
(
)
[_sendheader:protected] => 1
[_response_code:protected] => 200
)
bool(true)
bool(true)
bool(true)
bool(true)
array(3) {
["MyName1"]=>
string(16) "Header1, Header2"
["MyName2"]=>
string(8) "Header22"
["MyName3"]=>
string(8) "Header32"
}
NULL
string(16) "Header1, Header2"
Yaf_Response_Http Object
(
[_header:protected] => Array
(
)
[_body:protected] => Array
(
)
[_sendheader:protected] => 1
[_response_code:protected] => 302
)
bool(true)
array(3) {
["MyName1"]=>
string(8) "Header1x"
["MyName2"]=>
string(8) "Header2x"
["MyName3"]=>
string(5) "12345"
}