7 require_once
'Sabre/HTTP/ResponseMock.php';
18 $httpRequest =
new HTTP\Request(
'GET',
'/bar', [
'If-Match' =>
'*']);
19 $httpResponse =
new HTTP\Response();
20 $server->checkPreconditions($httpRequest, $httpResponse);
30 $httpRequest =
new HTTP\Request(
'GET',
'/foo', [
'If-Match' =>
'*']);
31 $httpResponse =
new HTTP\Response();
32 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
43 $httpRequest =
new HTTP\Request(
'GET',
'/foo', [
'If-Match' =>
'1234']);
44 $httpResponse =
new HTTP\Response();
45 $server->checkPreconditions($httpRequest, $httpResponse);
55 $httpRequest =
new HTTP\Request(
'GET',
'/foo', [
'If-Match' =>
'"abc123"']);
56 $httpResponse =
new HTTP\Response();
57 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
70 $httpRequest =
new HTTP\Request(
'GET',
'/foo', [
'If-Match' =>
'\\"abc123\\"']);
71 $httpResponse =
new HTTP\Response();
72 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
82 $httpRequest =
new HTTP\Request(
'GET',
'/foo', [
'If-Match' =>
'"hellothere", "abc123"']);
83 $httpResponse =
new HTTP\Response();
84 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
94 $httpRequest =
new HTTP\Request(
'GET',
'/bar', [
'If-None-Match' =>
'*']);
95 $httpResponse =
new HTTP\Response();
96 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
107 $httpRequest =
new HTTP\Request(
'POST',
'/foo', [
'If-None-Match' =>
'*']);
108 $httpResponse =
new HTTP\Response();
109 $server->checkPreconditions($httpRequest, $httpResponse);
119 $httpRequest =
new HTTP\Request(
'POST',
'/foo', [
'If-None-Match' =>
'"1234"']);
120 $httpResponse =
new HTTP\Response();
121 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
131 $httpRequest =
new HTTP\Request(
'POST',
'/foo', [
'If-None-Match' =>
'"1234", "5678"']);
132 $httpResponse =
new HTTP\Response();
133 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
144 $httpRequest =
new HTTP\Request(
'POST',
'/foo', [
'If-None-Match' =>
'"abc123"']);
145 $httpResponse =
new HTTP\Response();
146 $server->checkPreconditions($httpRequest, $httpResponse);
157 $httpRequest =
new HTTP\Request(
'POST',
'/foo', [
'If-None-Match' =>
'"1234, "abc123"']);
158 $httpResponse =
new HTTP\Response();
159 $server->checkPreconditions($httpRequest, $httpResponse);
169 $httpRequest =
new HTTP\Request(
'GET',
'/foo', [
'If-None-Match' =>
'"abc123"']);
170 $server->httpResponse =
new HTTP\ResponseMock();
172 $this->assertFalse(
$server->checkPreconditions($httpRequest,
$server->httpResponse));
173 $this->assertEquals(304,
$server->httpResponse->getStatus());
174 $this->assertEquals([
'ETag' => [
'"abc123"']],
$server->httpResponse->getHeaders());
185 $server->sapi =
new HTTP\SapiMock();
187 $httpRequest =
new HTTP\Request(
'GET',
'/foo', [
'If-None-Match' =>
'"abc123"']);
188 $server->httpRequest = $httpRequest;
189 $server->httpResponse =
new HTTP\ResponseMock();
193 $this->assertFalse(
$server->checkPreconditions($httpRequest,
$server->httpResponse));
194 $this->assertEquals(304,
$server->httpResponse->getStatus());
195 $this->assertEquals([
196 'ETag' => [
'"abc123"'],
198 ],
$server->httpResponse->getHeaders());
210 'HTTP_IF_MODIFIED_SINCE' =>
'Sun, 06 Nov 1994 08:49:37 GMT',
211 'REQUEST_URI' =>
'/foo' 213 $server->httpResponse =
new HTTP\ResponseMock();
214 $this->assertFalse(
$server->checkPreconditions($httpRequest,
$server->httpResponse));
216 $this->assertEquals(304,
$server->httpResponse->status);
217 $this->assertEquals([
218 'Last-Modified' => [
'Sat, 06 Apr 1985 23:30:00 GMT'],
219 ],
$server->httpResponse->getHeaders());
231 'HTTP_IF_MODIFIED_SINCE' =>
'Tue, 06 Nov 1984 08:49:37 GMT',
232 'REQUEST_URI' =>
'/foo' 235 $httpResponse =
new HTTP\ResponseMock();
236 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
247 'HTTP_IF_MODIFIED_SINCE' =>
'Your mother',
248 'REQUEST_URI' =>
'/foo' 250 $httpResponse =
new HTTP\ResponseMock();
253 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
264 'HTTP_IF_MODIFIED_SINCE' =>
'Sun, 06 Nov 1994 08:49:37 EST',
265 'REQUEST_URI' =>
'/foo' 267 $httpResponse =
new HTTP\ResponseMock();
268 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
280 'HTTP_IF_UNMODIFIED_SINCE' =>
'Sun, 06 Nov 1994 08:49:37 GMT',
281 'REQUEST_URI' =>
'/foo' 283 $httpResponse =
new HTTP\Response();
284 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
297 'HTTP_IF_UNMODIFIED_SINCE' =>
'Tue, 06 Nov 1984 08:49:37 GMT',
298 'REQUEST_URI' =>
'/foo' 300 $httpResponse =
new HTTP\ResponseMock();
301 $server->checkPreconditions($httpRequest, $httpResponse);
312 'HTTP_IF_UNMODIFIED_SINCE' =>
'Sun, 06 Nov 1984 08:49:37 CET',
313 'REQUEST_URI' =>
'/foo' 315 $httpResponse =
new HTTP\ResponseMock();
316 $this->assertTrue(
$server->checkPreconditions($httpRequest, $httpResponse));
334 return strtotime(
'1985-04-07 01:30 +02:00');
getLastModified()
Returns the last modification time, as a unix timestamp.
testIfMatchEvolutionEtag()
Evolution sometimes uses " instead of " for If-Match headers.
testIfNoneMatchHasNode()
Sabre
testIfNoneMatchCorrectEtagAsGet()
testIfModifiedSinceModified()
testIfMatchWrongEtag()
Sabre
getName()
Returns the name of the node.
testIfNoneMatchWrongEtag()
const VERSION
Full version number.
testNoneMatchCorrectEtagEnsureSapiSent()
This was a test written for issue #515.
testIfModifiedSinceInvalidDate2()
testIfNoneMatchCorrectEtag()
Sabre
testIfNoneMatchCorrectEtagMultiple()
Sabre
testIfModifiedSinceInvalidDate()
testIfModifiedSinceUnModified()
testIfNoneMatchWrongEtagMultiple()
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
testIfUnmodifiedSinceInvalidDate()
getETag()
Returns the ETag for a file.
testIfUnmodifiedSinceModified()
Sabre
testIfUnmodifiedSinceUnModified()