ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
FunctionsTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\HTTP;
4 
6 
11 
12  $this->assertEquals(
13  $output,
15  );
16 
17  }
18 
19  function getHeaderValuesData() {
20 
21  return [
22  [
23  "a",
24  ["a"]
25  ],
26  [
27  "a,b",
28  ["a", "b"]
29  ],
30  [
31  "a, b",
32  ["a", "b"]
33  ],
34  [
35  ["a, b"],
36  ["a", "b"]
37  ],
38  [
39  ["a, b", "c", "d,e"],
40  ["a", "b", "c", "d", "e"]
41  ],
42  ];
43 
44  }
45 
49  function testPrefer($input, $output) {
50 
51  $this->assertEquals(
52  $output,
54  );
55 
56  }
57 
58  function preferData() {
59 
60  return [
61  [
62  'foo; bar',
63  ['foo' => true]
64  ],
65  [
66  'foo; bar=""',
67  ['foo' => true]
68  ],
69  [
70  'foo=""; bar',
71  ['foo' => true]
72  ],
73  [
74  'FOO',
75  ['foo' => true]
76  ],
77  [
78  'respond-async',
79  ['respond-async' => true]
80  ],
81  [
82 
83  ['respond-async, wait=100', 'handling=lenient'],
84  ['respond-async' => true, 'wait' => 100, 'handling' => 'lenient']
85  ],
86  [
87 
88  ['respond-async, wait=100, handling=lenient'],
89  ['respond-async' => true, 'wait' => 100, 'handling' => 'lenient']
90  ],
91  // Old values
92  [
93 
94  'return-asynch, return-representation',
95  ['respond-async' => true, 'return' => 'representation'],
96  ],
97  [
98 
99  'return-minimal',
100  ['return' => 'minimal'],
101  ],
102  [
103 
104  'strict',
105  ['handling' => 'strict'],
106  ],
107  [
108 
109  'lenient',
110  ['handling' => 'lenient'],
111  ],
112  // Invalid token
113  [
114  ['foo=%bar%'],
115  [],
116  ]
117  ];
118 
119  }
120 
121 }
testPrefer($input, $output)
preferData
parsePrefer($input)
Parses the Prefer header, as defined in RFC7240.
Definition: functions.php:222
testGetHeaderValues($input, $output)
getHeaderValuesData
getHeaderValues($values, $values2=null)
This method splits up headers into all their individual values.
Definition: functions.php:301