summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2017-02-16 11:47:16 +0100
committerMorris Jobke <hey@morrisjobke.de>2017-03-23 00:02:48 -0600
commit89c42a76c34aba7dd4c23649f97495283cf023ba (patch)
tree4252d22cb431a00f8dcda5d52e0080d1fdff16d8 /apps/files_sharing
parent39ac804899197069b40384afdc40966e22658eca (diff)
downloadnextcloud-server-89c42a76c34aba7dd4c23649f97495283cf023ba.tar.gz
nextcloud-server-89c42a76c34aba7dd4c23649f97495283cf023ba.zip
Remove SharedCache::getNumericStorageId to let CacheWrapper do it
The CacheWrapper will properly forward the call to the wrapped cache. Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/Cache.php8
-rw-r--r--apps/files_sharing/tests/CacheTest.php24
2 files changed, 24 insertions, 8 deletions
diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php
index bc10ddbd94f..000cbf1baa5 100644
--- a/apps/files_sharing/lib/Cache.php
+++ b/apps/files_sharing/lib/Cache.php
@@ -71,14 +71,6 @@ class Cache extends CacheJail {
return $this->cache;
}
- public function getNumericStorageId() {
- if (isset($this->numericId)) {
- return $this->numericId;
- } else {
- return false;
- }
- }
-
public function get($file) {
if ($this->rootUnchanged && ($file === '' || $file === $this->sourceRootInfo->getId())) {
return $this->formatCacheEntry(clone $this->sourceRootInfo);
diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php
index ae0247a84e2..10db4104aae 100644
--- a/apps/files_sharing/tests/CacheTest.php
+++ b/apps/files_sharing/tests/CacheTest.php
@@ -525,4 +525,28 @@ class CacheTest extends TestCase {
$this->assertEquals('', $sharedCache->getPathById($folderInfo->getId()));
$this->assertEquals('bar/test.txt', $sharedCache->getPathById($fileInfo->getId()));
}
+
+ public function testNumericStorageId() {
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+ \OC\Files\Filesystem::mkdir('foo');
+
+ $rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1);
+ $node = $rootFolder->get('foo');
+ $share = $this->shareManager->newShare();
+ $share->setNode($node)
+ ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
+ ->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
+ ->setPermissions(\OCP\Constants::PERMISSION_ALL);
+ $this->shareManager->createShare($share);
+ \OC_Util::tearDownFS();
+
+ list($sourceStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER1 . '/files/foo');
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+ $this->assertTrue(\OC\Files\Filesystem::file_exists('/foo'));
+ list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo');
+
+ $this->assertEquals($sourceStorage->getCache()->getNumericStorageId(), $sharedStorage->getCache()->getNumericStorageId());
+ }
}