|
|
|
@ -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(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -98,46 +98,46 @@ class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base { |
|
|
|
|
function testSearchByMime() { |
|
|
|
|
$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' => 'files/shareddir/bar.txt' |
|
|
|
|
), |
|
|
|
|
array( |
|
|
|
|
'name' => 'another too.txt', |
|
|
|
|
'path' => 'shareddir/subdir/another too.txt' |
|
|
|
|
'path' => 'files/shareddir/subdir/another too.txt' |
|
|
|
|
), |
|
|
|
|
array( |
|
|
|
|
'name' => 'another.txt', |
|
|
|
|
'path' => 'shareddir/subdir/another.txt' |
|
|
|
|
'path' => 'files/shareddir/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' => 'files/shareddir/bar.txt', |
|
|
|
|
'mimetype' => 'text/plain', |
|
|
|
|
'usersPath' => 'files/Shared/shareddir/bar.txt' |
|
|
|
|
), |
|
|
|
|
array( |
|
|
|
|
'name' => 'emptydir', |
|
|
|
|
'path' => 'files/container/shareddir/emptydir', |
|
|
|
|
'path' => 'files/shareddir/emptydir', |
|
|
|
|
'mimetype' => 'httpd/unix-directory', |
|
|
|
|
'usersPath' => 'files/Shared/shareddir/emptydir' |
|
|
|
|
), |
|
|
|
|
array( |
|
|
|
|
'name' => 'subdir', |
|
|
|
|
'path' => 'files/container/shareddir/subdir', |
|
|
|
|
'path' => 'files/shareddir/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' => 'files/subdir/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' => 'files/subdir/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' => 'files/subdir/not a text file.xml', |
|
|
|
|
'mimetype' => 'application/xml', |
|
|
|
|
'usersPath' => 'files/Shared/subdir/not a text file.xml' |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
$results |
|
|
|
@ -254,8 +248,8 @@ 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 |
|
|
|
|
*/ |
|
|
|
@ -275,8 +269,8 @@ 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 |
|
|
|
|
*/ |
|
|
|
|