aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests/cache.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/tests/cache.php')
-rw-r--r--apps/files_sharing/tests/cache.php66
1 files changed, 30 insertions, 36 deletions
diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php
index 47969833ab5..1af73c558d5 100644
--- a/apps/files_sharing/tests/cache.php
+++ b/apps/files_sharing/tests/cache.php
@@ -68,7 +68,7 @@ class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base {
// retrieve the shared storage
$secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
- list($this->sharedStorage, $internalPath) = $secondView->resolvePath('files/Shared/shareddir');
+ list($this->sharedStorage, $internalPath) = $secondView->resolvePath('files/shareddir');
$this->sharedCache = $this->sharedStorage->getCache();
}
@@ -99,45 +99,45 @@ class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base {
$results = $this->sharedStorage->getCache()->searchByMime('text');
$check = array(
array(
- 'name' => 'shared single file.txt',
- 'path' => 'shared single file.txt'
- ),
- array(
'name' => 'bar.txt',
- 'path' => 'shareddir/bar.txt'
+ 'path' => 'bar.txt'
),
array(
'name' => 'another too.txt',
- 'path' => 'shareddir/subdir/another too.txt'
+ 'path' => 'subdir/another too.txt'
),
array(
'name' => 'another.txt',
- 'path' => 'shareddir/subdir/another.txt'
+ 'path' => 'subdir/another.txt'
),
);
$this->verifyFiles($check, $results);
- $results2 = $this->sharedStorage->getCache()->searchByMime('text/plain');
-
$this->verifyFiles($check, $results);
}
function testGetFolderContentsInRoot() {
- $results = $this->user2View->getDirectoryContent('/Shared/');
+ $results = $this->user2View->getDirectoryContent('/');
+ // we should get the shared items "shareddir" and "shared single file.txt"
+ // additional root will always contain the example file "welcome.txt",
+ // so this will be part of the result
$this->verifyFiles(
array(
array(
+ 'name' => 'welcome.txt',
+ 'path' => 'files/welcome.txt',
+ 'mimetype' => 'text/plain',
+ ),
+ array(
'name' => 'shareddir',
- 'path' => '/shareddir',
+ 'path' => 'files/shareddir',
'mimetype' => 'httpd/unix-directory',
- 'usersPath' => 'files/Shared/shareddir'
),
array(
'name' => 'shared single file.txt',
- 'path' => '/shared single file.txt',
+ 'path' => 'files/shared single file.txt',
'mimetype' => 'text/plain',
- 'usersPath' => 'files/Shared/shared single file.txt'
),
),
$results
@@ -145,27 +145,24 @@ class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base {
}
function testGetFolderContentsInSubdir() {
- $results = $this->user2View->getDirectoryContent('/Shared/shareddir');
+ $results = $this->user2View->getDirectoryContent('/shareddir');
$this->verifyFiles(
array(
array(
'name' => 'bar.txt',
- 'path' => 'files/container/shareddir/bar.txt',
+ 'path' => 'bar.txt',
'mimetype' => 'text/plain',
- 'usersPath' => 'files/Shared/shareddir/bar.txt'
),
array(
'name' => 'emptydir',
- 'path' => 'files/container/shareddir/emptydir',
+ 'path' => 'emptydir',
'mimetype' => 'httpd/unix-directory',
- 'usersPath' => 'files/Shared/shareddir/emptydir'
),
array(
'name' => 'subdir',
- 'path' => 'files/container/shareddir/subdir',
+ 'path' => 'subdir',
'mimetype' => 'httpd/unix-directory',
- 'usersPath' => 'files/Shared/shareddir/subdir'
),
),
$results
@@ -182,27 +179,24 @@ class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base {
self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
$thirdView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER3 . '/files');
- $results = $thirdView->getDirectoryContent('/Shared/subdir');
+ $results = $thirdView->getDirectoryContent('/subdir');
$this->verifyFiles(
array(
array(
'name' => 'another too.txt',
- 'path' => 'files/container/shareddir/subdir/another too.txt',
+ 'path' => 'another too.txt',
'mimetype' => 'text/plain',
- 'usersPath' => 'files/Shared/subdir/another too.txt'
),
array(
'name' => 'another.txt',
- 'path' => 'files/container/shareddir/subdir/another.txt',
+ 'path' => 'another.txt',
'mimetype' => 'text/plain',
- 'usersPath' => 'files/Shared/subdir/another.txt'
),
array(
'name' => 'not a text file.xml',
- 'path' => 'files/container/shareddir/subdir/not a text file.xml',
+ 'path' => 'not a text file.xml',
'mimetype' => 'application/xml',
- 'usersPath' => 'files/Shared/subdir/not a text file.xml'
),
),
$results
@@ -254,14 +248,14 @@ class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base {
\OC_Util::tearDownFS();
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
- $this->assertTrue(\OC\Files\Filesystem::file_exists('/Shared/test.txt'));
- list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/Shared/test.txt');
+ $this->assertTrue(\OC\Files\Filesystem::file_exists('/test.txt'));
+ list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test.txt');
/**
* @var \OC\Files\Storage\Shared $sharedStorage
*/
$sharedCache = $sharedStorage->getCache();
- $this->assertEquals('test.txt', $sharedCache->getPathById($info->getId()));
+ $this->assertEquals('', $sharedCache->getPathById($info->getId()));
}
public function testGetPathByIdShareSubFolder() {
@@ -275,14 +269,14 @@ class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base {
\OC_Util::tearDownFS();
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
- $this->assertTrue(\OC\Files\Filesystem::file_exists('/Shared/foo'));
- list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/Shared/foo');
+ $this->assertTrue(\OC\Files\Filesystem::file_exists('/foo'));
+ list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo');
/**
* @var \OC\Files\Storage\Shared $sharedStorage
*/
$sharedCache = $sharedStorage->getCache();
- $this->assertEquals('foo', $sharedCache->getPathById($folderInfo->getId()));
- $this->assertEquals('foo/bar/test.txt', $sharedCache->getPathById($fileInfo->getId()));
+ $this->assertEquals('', $sharedCache->getPathById($folderInfo->getId()));
+ $this->assertEquals('bar/test.txt', $sharedCache->getPathById($fileInfo->getId()));
}
}