Skip to content
Snippets Groups Projects
Unverified Commit d766d09f authored by Daniel Kesselberg's avatar Daniel Kesselberg
Browse files

Add test to ensure that symlinked apps_paths are not resolved

parent 72a16b17
No related branches found
No related tags found
No related merge requests found
...@@ -338,6 +338,35 @@ class AppManagerTest extends TestCase { ...@@ -338,6 +338,35 @@ class AppManagerTest extends TestCase {
$this->assertEquals(\OC::$SERVERROOT . '/apps/files', $this->manager->getAppPath('files')); $this->assertEquals(\OC::$SERVERROOT . '/apps/files', $this->manager->getAppPath('files'));
} }
public function testGetAppPathSymlink() {
$fakeAppDirname = sha1(uniqid('test', true));
$fakeAppPath = sys_get_temp_dir() . '/' . $fakeAppDirname;
$fakeAppLink = \OC::$SERVERROOT . '/' . $fakeAppDirname;
mkdir($fakeAppPath);
if (symlink($fakeAppPath, $fakeAppLink) === false) {
$this->markTestSkipped('Failed to create symlink');
}
// Use the symlink as the app path
\OC::$APPSROOTS[] = [
'path' => $fakeAppLink,
'url' => \OC::$WEBROOT . '/' . $fakeAppDirname,
'writable' => false,
];
$fakeTestAppPath = $fakeAppPath . '/' . 'test-test-app';
mkdir($fakeTestAppPath);
$generatedAppPath = $this->manager->getAppPath('test-test-app');
rmdir($fakeTestAppPath);
unlink($fakeAppLink);
rmdir($fakeAppPath);
$this->assertEquals($fakeAppLink . '/test-test-app', $generatedAppPath);
}
public function testGetAppPathFail() { public function testGetAppPathFail() {
$this->expectException(AppPathNotFoundException::class); $this->expectException(AppPathNotFoundException::class);
$this->manager->getAppPath('testnotexisting'); $this->manager->getAppPath('testnotexisting');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment