3737use OC \Files \View ;
3838use OCA \DAV \Connector \Sabre \File ;
3939use OCP \Constants ;
40+ use OCP \Files \FileInfo ;
4041use OCP \Files \ForbiddenException ;
4142use OCP \Files \Storage ;
4243use OCP \IConfig ;
@@ -211,7 +212,8 @@ function ($path) use ($storage) {
211212 ->willReturnArgument (0 );
212213
213214 $ info = new \OC \Files \FileInfo ('/test.txt ' , $ this ->getMockStorage (), null , [
214- 'permissions ' => \OCP \Constants::PERMISSION_ALL
215+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
216+ 'type ' => FileInfo::TYPE_FOLDER ,
215217 ], null );
216218
217219 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
@@ -272,7 +274,8 @@ function ($path) use ($storage) {
272274 $ _SERVER ['HTTP_OC_CHUNKED ' ] = true ;
273275
274276 $ info = new \OC \Files \FileInfo ('/test.txt-chunking-12345-2-0 ' , $ this ->getMockStorage (), null , [
275- 'permissions ' => \OCP \Constants::PERMISSION_ALL
277+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
278+ 'type ' => FileInfo::TYPE_FOLDER ,
276279 ], null );
277280 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
278281
@@ -282,7 +285,8 @@ function ($path) use ($storage) {
282285 $ file ->releaseLock (ILockingProvider::LOCK_SHARED );
283286
284287 $ info = new \OC \Files \FileInfo ('/test.txt-chunking-12345-2-1 ' , $ this ->getMockStorage (), null , [
285- 'permissions ' => \OCP \Constants::PERMISSION_ALL
288+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
289+ 'type ' => FileInfo::TYPE_FOLDER ,
286290 ], null );
287291 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
288292
@@ -326,7 +330,10 @@ private function doPut($path, $viewRoot = null, Request $request = null) {
326330 $ viewRoot . '/ ' . ltrim ($ path , '/ ' ),
327331 $ this ->getMockStorage (),
328332 null ,
329- ['permissions ' => \OCP \Constants::PERMISSION_ALL ],
333+ [
334+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
335+ 'type ' => FileInfo::TYPE_FOLDER ,
336+ ],
330337 null
331338 );
332339
@@ -690,7 +697,8 @@ public function testSimplePutFailsSizeCheck() {
690697 $ _SERVER ['REQUEST_METHOD ' ] = 'PUT ' ;
691698
692699 $ info = new \OC \Files \FileInfo ('/test.txt ' , $ this ->getMockStorage (), null , [
693- 'permissions ' => \OCP \Constants::PERMISSION_ALL
700+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
701+ 'type ' => FileInfo::TYPE_FOLDER ,
694702 ], null );
695703
696704 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
@@ -723,7 +731,8 @@ public function testSimplePutFailsMoveFromStorage() {
723731 $ view ->lockFile ('/test.txt ' , ILockingProvider::LOCK_EXCLUSIVE );
724732
725733 $ info = new \OC \Files \FileInfo ('/ ' . $ this ->user . '/files/test.txt ' , $ this ->getMockStorage (), null , [
726- 'permissions ' => \OCP \Constants::PERMISSION_ALL
734+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
735+ 'type ' => FileInfo::TYPE_FOLDER ,
727736 ], null );
728737
729738 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
@@ -758,15 +767,17 @@ public function testChunkedPutFailsFinalRename() {
758767 $ _SERVER ['HTTP_OC_CHUNKED ' ] = true ;
759768
760769 $ info = new \OC \Files \FileInfo ('/ ' . $ this ->user . '/files/test.txt-chunking-12345-2-0 ' , $ this ->getMockStorage (), null , [
761- 'permissions ' => \OCP \Constants::PERMISSION_ALL
770+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
771+ 'type ' => FileInfo::TYPE_FOLDER ,
762772 ], null );
763773 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
764774 $ file ->acquireLock (ILockingProvider::LOCK_SHARED );
765775 $ this ->assertNull ($ file ->put ('test data one ' ));
766776 $ file ->releaseLock (ILockingProvider::LOCK_SHARED );
767777
768778 $ info = new \OC \Files \FileInfo ('/ ' . $ this ->user . '/files/test.txt-chunking-12345-2-1 ' , $ this ->getMockStorage (), null , [
769- 'permissions ' => \OCP \Constants::PERMISSION_ALL
779+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
780+ 'type ' => FileInfo::TYPE_FOLDER ,
770781 ], null );
771782 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
772783
@@ -797,7 +808,8 @@ public function testSimplePutInvalidChars() {
797808 ->willReturnArgument (0 );
798809
799810 $ info = new \OC \Files \FileInfo ('/* ' , $ this ->getMockStorage (), null , [
800- 'permissions ' => \OCP \Constants::PERMISSION_ALL
811+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
812+ 'type ' => FileInfo::TYPE_FOLDER ,
801813 ], null );
802814 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
803815
@@ -836,7 +848,8 @@ public function testSetNameInvalidChars() {
836848 ->willReturnArgument (0 );
837849
838850 $ info = new \OC \Files \FileInfo ('/* ' , $ this ->getMockStorage (), null , [
839- 'permissions ' => \OCP \Constants::PERMISSION_ALL
851+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
852+ 'type ' => FileInfo::TYPE_FOLDER ,
840853 ], null );
841854 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
842855 $ file ->setName ('/super*star.txt ' );
@@ -863,7 +876,8 @@ public function testUploadAbort() {
863876 $ _SERVER ['REQUEST_METHOD ' ] = 'PUT ' ;
864877
865878 $ info = new \OC \Files \FileInfo ('/test.txt ' , $ this ->getMockStorage (), null , [
866- 'permissions ' => \OCP \Constants::PERMISSION_ALL
879+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
880+ 'type ' => FileInfo::TYPE_FOLDER ,
867881 ], null );
868882
869883 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
@@ -897,7 +911,8 @@ public function testDeleteWhenAllowed() {
897911 ->willReturn (true );
898912
899913 $ info = new \OC \Files \FileInfo ('/test.txt ' , $ this ->getMockStorage (), null , [
900- 'permissions ' => \OCP \Constants::PERMISSION_ALL
914+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
915+ 'type ' => FileInfo::TYPE_FOLDER ,
901916 ], null );
902917
903918 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
@@ -915,7 +930,8 @@ public function testDeleteThrowsWhenDeletionNotAllowed() {
915930 ->getMock ();
916931
917932 $ info = new \OC \Files \FileInfo ('/test.txt ' , $ this ->getMockStorage (), null , [
918- 'permissions ' => 0
933+ 'permissions ' => 0 ,
934+ 'type ' => FileInfo::TYPE_FOLDER ,
919935 ], null );
920936
921937 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
@@ -938,7 +954,8 @@ public function testDeleteThrowsWhenDeletionFailed() {
938954 ->willReturn (false );
939955
940956 $ info = new \OC \Files \FileInfo ('/test.txt ' , $ this ->getMockStorage (), null , [
941- 'permissions ' => \OCP \Constants::PERMISSION_ALL
957+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
958+ 'type ' => FileInfo::TYPE_FOLDER ,
942959 ], null );
943960
944961 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
@@ -961,7 +978,8 @@ public function testDeleteThrowsWhenDeletionThrows() {
961978 ->willThrowException (new ForbiddenException ('' , true ));
962979
963980 $ info = new \OC \Files \FileInfo ('/test.txt ' , $ this ->getMockStorage (), null , [
964- 'permissions ' => \OCP \Constants::PERMISSION_ALL
981+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
982+ 'type ' => FileInfo::TYPE_FOLDER ,
965983 ], null );
966984
967985 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
@@ -997,7 +1015,10 @@ public function testPutLocking() {
9971015 '/ ' . $ this ->user . '/files/ ' . $ path ,
9981016 $ this ->getMockStorage (),
9991017 null ,
1000- ['permissions ' => \OCP \Constants::PERMISSION_ALL ],
1018+ [
1019+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
1020+ 'type ' => FileInfo::TYPE_FOLDER ,
1021+ ],
10011022 null
10021023 );
10031024
@@ -1129,7 +1150,8 @@ public function testGetFopenFails() {
11291150 ->willReturn (false );
11301151
11311152 $ info = new \OC \Files \FileInfo ('/test.txt ' , $ this ->getMockStorage (), null , [
1132- 'permissions ' => \OCP \Constants::PERMISSION_ALL
1153+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
1154+ 'type ' => FileInfo::TYPE_FOLDER ,
11331155 ], null );
11341156
11351157 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
@@ -1149,7 +1171,8 @@ public function testGetFopenThrows() {
11491171 ->willThrowException (new ForbiddenException ('' , true ));
11501172
11511173 $ info = new \OC \Files \FileInfo ('/test.txt ' , $ this ->getMockStorage (), null , [
1152- 'permissions ' => \OCP \Constants::PERMISSION_ALL
1174+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
1175+ 'type ' => FileInfo::TYPE_FOLDER ,
11531176 ], null );
11541177
11551178 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
@@ -1168,7 +1191,8 @@ public function testGetThrowsIfNoPermission() {
11681191 ->method ('fopen ' );
11691192
11701193 $ info = new \OC \Files \FileInfo ('/test.txt ' , $ this ->getMockStorage (), null , [
1171- 'permissions ' => \OCP \Constants::PERMISSION_CREATE // no read perm
1194+ 'permissions ' => \OCP \Constants::PERMISSION_CREATE , // no read perm
1195+ 'type ' => FileInfo::TYPE_FOLDER ,
11721196 ], null );
11731197
11741198 $ file = new \OCA \DAV \Connector \Sabre \File ($ view , $ info );
@@ -1215,7 +1239,10 @@ public function testPutLockExpired() {
12151239 '/ ' . $ this ->user . '/files/ ' . $ path ,
12161240 $ this ->getMockStorage (),
12171241 null ,
1218- ['permissions ' => \OCP \Constants::PERMISSION_ALL ],
1242+ [
1243+ 'permissions ' => \OCP \Constants::PERMISSION_ALL ,
1244+ 'type ' => FileInfo::TYPE_FOLDER ,
1245+ ],
12191246 null
12201247 );
12211248
0 commit comments