File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -336,6 +336,36 @@ public function testGetAppPath() {
336
336
$ this ->assertEquals (\OC ::$ SERVERROOT . '/apps/files ' , $ this ->manager ->getAppPath ('files ' ));
337
337
}
338
338
339
+ public function testGetAppPathSymlink () {
340
+ $ fakeAppDirname = sha1 (uniqid ('test ' , true ));
341
+ $ fakeAppPath = sys_get_temp_dir () . '/ ' . $ fakeAppDirname ;
342
+ $ fakeAppLink = \OC ::$ SERVERROOT . '/ ' . $ fakeAppDirname ;
343
+
344
+ mkdir ($ fakeAppPath );
345
+ if (symlink ($ fakeAppPath , $ fakeAppLink ) === false ) {
346
+ $ this ->markTestSkipped ('Failed to create symlink ' );
347
+ }
348
+
349
+ // Use the symlink as the app path
350
+ \OC ::$ APPSROOTS [] = [
351
+ 'path ' => $ fakeAppLink ,
352
+ 'url ' => \OC ::$ WEBROOT . '/ ' . $ fakeAppDirname ,
353
+ 'writable ' => false ,
354
+ ];
355
+
356
+ $ fakeTestAppPath = $ fakeAppPath . '/ ' . 'test-test-app ' ;
357
+ mkdir ($ fakeTestAppPath );
358
+
359
+ $ generatedAppPath = $ this ->manager ->getAppPath ('test-test-app ' );
360
+
361
+ rmdir ($ fakeTestAppPath );
362
+ unlink ($ fakeAppLink );
363
+ rmdir ($ fakeAppPath );
364
+
365
+ $ this ->assertEquals ($ fakeAppLink . '/test-test-app ' , $ generatedAppPath );
366
+ }
367
+
368
+
339
369
public function testGetAppPathFail () {
340
370
$ this ->expectException (AppPathNotFoundException::class);
341
371
$ this ->manager ->getAppPath ('testnotexisting ' );
You can’t perform that action at this time.
0 commit comments