ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\HttpCopyTest Class Reference

Tests related to the COPY request. More...

+ Inheritance diagram for Sabre\DAV\HttpCopyTest:
+ Collaboration diagram for Sabre\DAV\HttpCopyTest:

Public Member Functions

 setUpTree ()
 Sets up the DAV tree. More...
 
 testCopyFile ()
 
 testCopyFileToSelf ()
 
 testCopyFileToExisting ()
 
 testCopyFileToExistingOverwriteT ()
 
 testCopyFileToExistingOverwriteBadValue ()
 
 testCopyFileNonExistantParent ()
 
 testCopyFileToExistingOverwriteF ()
 
 testCopyFileToExistinBlockedCreateDestination ()
 
 testCopyColl ()
 
 testCopyCollToSelf ()
 
 testCopyCollToExisting ()
 
 testCopyCollToExistingOverwriteT ()
 
 testCopyCollToExistingOverwriteF ()
 
 testCopyCollIntoSubtree ()
 
- Public Member Functions inherited from Sabre\DAVServerTest
 setUp ()
 
 initializeEverything ()
 
 request ($request, $expectedStatus=null)
 Makes a request, and returns a response object. More...
 
 autoLogin ($userName)
 This function takes a username and sets the server in a state where this user is logged in, and no longer requires an authentication check. More...
 
 setUpTree ()
 Override this to provide your own Tree for your test-case. More...
 
 setUpBackends ()
 
 assertHttpStatus ($expectedStatus, HTTP\Request $req)
 

Additional Inherited Members

- Protected Attributes inherited from Sabre\DAVServerTest
 $setupCalDAV = false
 
 $setupCardDAV = false
 
 $setupACL = false
 
 $setupCalDAVSharing = false
 
 $setupCalDAVScheduling = false
 
 $setupCalDAVSubscriptions = false
 
 $setupCalDAVICSExport = false
 
 $setupLocks = false
 
 $setupFiles = false
 
 $setupSharing = false
 
 $setupPropertyStorage = false
 
 $caldavCalendars = []
 An array with calendars. More...
 
 $caldavCalendarObjects = []
 
 $carddavAddressBooks = []
 
 $carddavCards = []
 
 $server
 
 $tree = []
 
 $caldavBackend
 
 $carddavBackend
 
 $principalBackend
 
 $locksBackend
 
 $propertyStorageBackend
 
 $caldavPlugin
 
 $carddavPlugin
 
 $aclPlugin
 
 $caldavSharingPlugin
 
 $caldavSchedulePlugin
 
 $authPlugin
 
 $locksPlugin
 
 $sharingPlugin
 
 $propertyStoragePlugin
 
 $autoLogin = null
 If this string is set, we will automatically log in the user with this name. More...
 

Detailed Description

Tests related to the COPY request.

Author
Evert Pot (http://evertpot.com/) @license http://sabre.io/license/ Modified BSD License

Definition at line 15 of file HttpCopyTest.php.

Member Function Documentation

◆ setUpTree()

Sabre\DAV\HttpCopyTest::setUpTree ( )

Sets up the DAV tree.

Returns
void

Reimplemented from Sabre\DAVServerTest.

Definition at line 22 of file HttpCopyTest.php.

22 {
23
24 $this->tree = new Mock\Collection('root', [
25 'file1' => 'content1',
26 'file2' => 'content2',
27 'coll1' => [
28 'file3' => 'content3',
29 'file4' => 'content4',
30 ]
31 ]);
32
33 }

◆ testCopyColl()

Sabre\DAV\HttpCopyTest::testCopyColl ( )

Definition at line 132 of file HttpCopyTest.php.

132 {
133
134 $request = new HTTP\Request('COPY', '/coll1', [
135 'Destination' => '/coll2'
136 ]);
137 $response = $this->request($request);
138 $this->assertEquals(201, $response->getStatus());
139 $this->assertEquals('content3', $this->tree->getChild('coll2')->getChild('file3')->get());
140
141 }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyCollIntoSubtree()

Sabre\DAV\HttpCopyTest::testCopyCollIntoSubtree ( )

Definition at line 188 of file HttpCopyTest.php.

188 {
189
190 $request = new HTTP\Request('COPY', '/coll1', [
191 'Destination' => '/coll1/subcol',
192 ]);
193 $response = $this->request($request);
194 $this->assertEquals(409, $response->getStatus());
195
196 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyCollToExisting()

Sabre\DAV\HttpCopyTest::testCopyCollToExisting ( )

Definition at line 153 of file HttpCopyTest.php.

153 {
154
155 $request = new HTTP\Request('COPY', '/coll1', [
156 'Destination' => '/file2'
157 ]);
158 $response = $this->request($request);
159 $this->assertEquals(204, $response->getStatus());
160 $this->assertEquals('content3', $this->tree->getChild('file2')->getChild('file3')->get());
161
162 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyCollToExistingOverwriteF()

Sabre\DAV\HttpCopyTest::testCopyCollToExistingOverwriteF ( )

Definition at line 176 of file HttpCopyTest.php.

176 {
177
178 $request = new HTTP\Request('COPY', '/coll1', [
179 'Destination' => '/file2',
180 'Overwrite' => 'F',
181 ]);
182 $response = $this->request($request);
183 $this->assertEquals(412, $response->getStatus());
184 $this->assertEquals('content2', $this->tree->getChild('file2')->get());
185
186 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyCollToExistingOverwriteT()

Sabre\DAV\HttpCopyTest::testCopyCollToExistingOverwriteT ( )

Definition at line 164 of file HttpCopyTest.php.

164 {
165
166 $request = new HTTP\Request('COPY', '/coll1', [
167 'Destination' => '/file2',
168 'Overwrite' => 'T',
169 ]);
170 $response = $this->request($request);
171 $this->assertEquals(204, $response->getStatus());
172 $this->assertEquals('content3', $this->tree->getChild('file2')->getChild('file3')->get());
173
174 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyCollToSelf()

Sabre\DAV\HttpCopyTest::testCopyCollToSelf ( )

Definition at line 143 of file HttpCopyTest.php.

143 {
144
145 $request = new HTTP\Request('COPY', '/coll1', [
146 'Destination' => '/coll1'
147 ]);
148 $response = $this->request($request);
149 $this->assertEquals(403, $response->getStatus());
150
151 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyFile()

Sabre\DAV\HttpCopyTest::testCopyFile ( )

Definition at line 35 of file HttpCopyTest.php.

35 {
36
37 $request = new HTTP\Request('COPY', '/file1', [
38 'Destination' => '/file5'
39 ]);
40 $response = $this->request($request);
41 $this->assertEquals(201, $response->getStatus());
42 $this->assertEquals('content1', $this->tree->getChild('file5')->get());
43
44 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyFileNonExistantParent()

Sabre\DAV\HttpCopyTest::testCopyFileNonExistantParent ( )

Definition at line 90 of file HttpCopyTest.php.

90 {
91
92 $request = new HTTP\Request('COPY', '/file1', [
93 'Destination' => '/notfound/file2',
94 ]);
95 $response = $this->request($request);
96 $this->assertEquals(409, $response->getStatus());
97
98 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyFileToExistinBlockedCreateDestination()

Sabre\DAV\HttpCopyTest::testCopyFileToExistinBlockedCreateDestination ( )

Definition at line 112 of file HttpCopyTest.php.

112 {
113
114 $this->server->on('beforeBind', function($path) {
115
116 if ($path === 'file2') {
117 return false;
118 }
119
120 });
121 $request = new HTTP\Request('COPY', '/file1', [
122 'Destination' => '/file2',
123 'Overwrite' => 'T',
124 ]);
125 $response = $this->request($request);
126
127 // This checks if the destination file is intact.
128 $this->assertEquals('content2', $this->tree->getChild('file2')->get());
129
130 }
$path
Definition: aliased.php:25

References $path, $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyFileToExisting()

Sabre\DAV\HttpCopyTest::testCopyFileToExisting ( )

Definition at line 56 of file HttpCopyTest.php.

56 {
57
58 $request = new HTTP\Request('COPY', '/file1', [
59 'Destination' => '/file2'
60 ]);
61 $response = $this->request($request);
62 $this->assertEquals(204, $response->getStatus());
63 $this->assertEquals('content1', $this->tree->getChild('file2')->get());
64
65 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyFileToExistingOverwriteBadValue()

Sabre\DAV\HttpCopyTest::testCopyFileToExistingOverwriteBadValue ( )

Definition at line 79 of file HttpCopyTest.php.

79 {
80
81 $request = new HTTP\Request('COPY', '/file1', [
82 'Destination' => '/file2',
83 'Overwrite' => 'B',
84 ]);
85 $response = $this->request($request);
86 $this->assertEquals(400, $response->getStatus());
87
88 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyFileToExistingOverwriteF()

Sabre\DAV\HttpCopyTest::testCopyFileToExistingOverwriteF ( )

Definition at line 100 of file HttpCopyTest.php.

100 {
101
102 $request = new HTTP\Request('COPY', '/file1', [
103 'Destination' => '/file2',
104 'Overwrite' => 'F',
105 ]);
106 $response = $this->request($request);
107 $this->assertEquals(412, $response->getStatus());
108 $this->assertEquals('content2', $this->tree->getChild('file2')->get());
109
110 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyFileToExistingOverwriteT()

Sabre\DAV\HttpCopyTest::testCopyFileToExistingOverwriteT ( )

Definition at line 67 of file HttpCopyTest.php.

67 {
68
69 $request = new HTTP\Request('COPY', '/file1', [
70 'Destination' => '/file2',
71 'Overwrite' => 'T',
72 ]);
73 $response = $this->request($request);
74 $this->assertEquals(204, $response->getStatus());
75 $this->assertEquals('content1', $this->tree->getChild('file2')->get());
76
77 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

◆ testCopyFileToSelf()

Sabre\DAV\HttpCopyTest::testCopyFileToSelf ( )

Definition at line 46 of file HttpCopyTest.php.

46 {
47
48 $request = new HTTP\Request('COPY', '/file1', [
49 'Destination' => '/file1'
50 ]);
51 $response = $this->request($request);
52 $this->assertEquals(403, $response->getStatus());
53
54 }

References $request, $response, and Sabre\DAVServerTest\request().

+ Here is the call graph for this function:

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