ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\Locks\MSWordTest Class Reference
+ Inheritance diagram for Sabre\DAV\Locks\MSWordTest:
+ Collaboration diagram for Sabre\DAV\Locks\MSWordTest:

Public Member Functions

 tearDown ()
 
 testLockEtc ()
 
 getLockRequest ()
 
 getLockRequest2 ()
 
 getPutRequest ($lockToken)
 

Detailed Description

Definition at line 11 of file MSWordTest.php.

Member Function Documentation

◆ getLockRequest()

Sabre\DAV\Locks\MSWordTest::getLockRequest ( )

Definition at line 63 of file MSWordTest.php.

63 {
64
66 'REQUEST_METHOD' => 'LOCK',
67 'HTTP_CONTENT_TYPE' => 'application/xml',
68 'HTTP_TIMEOUT' => 'Second-3600',
69 'REQUEST_URI' => '/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx',
70 ]);
71
72 $request->setBody('<D:lockinfo xmlns:D="DAV:">
73 <D:lockscope>
74 <D:exclusive />
75 </D:lockscope>
76 <D:locktype>
77 <D:write />
78 </D:locktype>
79 <D:owner>
80 <D:href>PC-Vista\User</D:href>
81 </D:owner>
82</D:lockinfo>');
83
84 return $request;
85
86 }
foreach($paths as $path) $request
Definition: asyncclient.php:32
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107

References $request, and Sabre\HTTP\Sapi\createFromServerArray().

Referenced by Sabre\DAV\Locks\MSWordTest\testLockEtc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLockRequest2()

Sabre\DAV\Locks\MSWordTest::getLockRequest2 ( )

Definition at line 87 of file MSWordTest.php.

87 {
88
90 'REQUEST_METHOD' => 'LOCK',
91 'HTTP_CONTENT_TYPE' => 'application/xml',
92 'HTTP_TIMEOUT' => 'Second-3600',
93 'REQUEST_URI' => '/~$Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx',
94 ]);
95
96 $request->setBody('<D:lockinfo xmlns:D="DAV:">
97 <D:lockscope>
98 <D:exclusive />
99 </D:lockscope>
100 <D:locktype>
101 <D:write />
102 </D:locktype>
103 <D:owner>
104 <D:href>PC-Vista\User</D:href>
105 </D:owner>
106</D:lockinfo>');
107
108 return $request;
109
110 }

References $request, and Sabre\HTTP\Sapi\createFromServerArray().

Referenced by Sabre\DAV\Locks\MSWordTest\testLockEtc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPutRequest()

Sabre\DAV\Locks\MSWordTest::getPutRequest (   $lockToken)

Definition at line 112 of file MSWordTest.php.

112 {
113
115 'REQUEST_METHOD' => 'PUT',
116 'REQUEST_URI' => '/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx',
117 'HTTP_IF' => 'If: (' . $lockToken . ')',
118 ]);
119 $request->setBody('FAKE BODY');
120 return $request;
121
122 }

References $request, and Sabre\HTTP\Sapi\createFromServerArray().

Referenced by Sabre\DAV\Locks\MSWordTest\testLockEtc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tearDown()

Sabre\DAV\Locks\MSWordTest::tearDown ( )

Definition at line 13 of file MSWordTest.php.

13 {
14
16
17 }
static clearTempDir()
This function deletes all the contents of the temporary directory.
Definition: TestUtil.php:12

References Sabre\TestUtil\clearTempDir().

+ Here is the call graph for this function:

◆ testLockEtc()

Sabre\DAV\Locks\MSWordTest::testLockEtc ( )

Definition at line 19 of file MSWordTest.php.

19 {
20
21 mkdir(SABRE_TEMPDIR . '/mstest');
22 $tree = new DAV\FS\Directory(SABRE_TEMPDIR . '/mstest');
23
24 $server = new DAV\Server($tree);
25 $server->debugExceptions = true;
26 $locksBackend = new Backend\File(SABRE_TEMPDIR . '/locksdb');
27 $locksPlugin = new Plugin($locksBackend);
28 $server->addPlugin($locksPlugin);
29
30 $response1 = new HTTP\ResponseMock();
31
32 $server->httpRequest = $this->getLockRequest();
33 $server->httpResponse = $response1;
34 $server->sapi = new HTTP\SapiMock();
35 $server->exec();
36
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');
40
41 //sleep(10);
42
43 $response2 = new HTTP\ResponseMock();
44
45 $server->httpRequest = $this->getLockRequest2();
46 $server->httpResponse = $response2;
47 $server->exec();
48
49 $this->assertEquals(201, $server->httpResponse->status);
50 $this->assertTrue(!!$server->httpResponse->getHeaders('Lock-Token'));
51
52 //sleep(10);
53
54 $response3 = new HTTP\ResponseMock();
55 $server->httpRequest = $this->getPutRequest($lockToken);
56 $server->httpResponse = $response3;
57 $server->exec();
58
59 $this->assertEquals(204, $server->httpResponse->status);
60
61 }
$server
Definition: sabredav.php:48

References $server, $tree, Sabre\DAV\Locks\MSWordTest\getLockRequest(), Sabre\DAV\Locks\MSWordTest\getLockRequest2(), and Sabre\DAV\Locks\MSWordTest\getPutRequest().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: