8 require_once
'Sabre/HTTP/ResponseMock.php';
9 require_once
'Sabre/TestUtil.php';
21 mkdir(SABRE_TEMPDIR .
'/mstest');
25 $server->debugExceptions =
true;
26 $locksBackend =
new Backend\File(SABRE_TEMPDIR .
'/locksdb');
27 $locksPlugin =
new Plugin($locksBackend);
28 $server->addPlugin($locksPlugin);
30 $response1 =
new HTTP\ResponseMock();
33 $server->httpResponse = $response1;
34 $server->sapi =
new HTTP\SapiMock();
37 $this->assertEquals(201,
$server->httpResponse->getStatus(),
'Full response body:' . $response1->getBodyAsString());
38 $this->assertTrue(!!
$server->httpResponse->getHeaders(
'Lock-Token'));
39 $lockToken =
$server->httpResponse->getHeader(
'Lock-Token');
43 $response2 =
new HTTP\ResponseMock();
46 $server->httpResponse = $response2;
49 $this->assertEquals(201,
$server->httpResponse->status);
50 $this->assertTrue(!!
$server->httpResponse->getHeaders(
'Lock-Token'));
54 $response3 =
new HTTP\ResponseMock();
56 $server->httpResponse = $response3;
59 $this->assertEquals(204,
$server->httpResponse->status);
66 'REQUEST_METHOD' =>
'LOCK',
67 'HTTP_CONTENT_TYPE' =>
'application/xml',
68 'HTTP_TIMEOUT' =>
'Second-3600',
69 'REQUEST_URI' =>
'/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx',
72 $request->setBody(
'<D:lockinfo xmlns:D="DAV:"> 80 <D:href>PC-Vista\User</D:href> 90 'REQUEST_METHOD' =>
'LOCK',
91 'HTTP_CONTENT_TYPE' =>
'application/xml',
92 'HTTP_TIMEOUT' =>
'Second-3600',
93 'REQUEST_URI' =>
'/~$Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx',
96 $request->setBody(
'<D:lockinfo xmlns:D="DAV:"> 104 <D:href>PC-Vista\User</D:href> 115 'REQUEST_METHOD' =>
'PUT',
116 'REQUEST_URI' =>
'/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx',
117 'HTTP_IF' =>
'If: (' . $lockToken .
')',
foreach($paths as $path) $request
getPutRequest($lockToken)
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
static clearTempDir()
This function deletes all the contents of the temporary directory.