]> source.dussan.org Git - nextcloud-server.git/commitdiff
[Sharing 2.0] Do not use static function to get numeric storage id
authorRoeland Jago Douma <rullzer@owncloud.com>
Tue, 5 Jan 2016 10:42:54 +0000 (11:42 +0100)
committerRoeland Jago Douma <rullzer@owncloud.com>
Wed, 6 Jan 2016 13:53:43 +0000 (14:53 +0100)
apps/files_sharing/api/share20ocs.php
apps/files_sharing/tests/api/share20ocstest.php

index 8bab8a871e3307d57ff289ea71107d596d3e59b8..69e2f5704998ef668e223dfe30c34e4a8354ace4 100644 (file)
@@ -97,7 +97,7 @@ class Share20OCS {
                        $result['item_type'] = 'file';
                }
                $result['storage_id'] = $path->getStorage()->getId();
-               $result['storage'] = \OC\Files\Cache\Storage::getNumericStorageId($path->getStorage()->getId());
+               $result['storage'] = $path->getStorage()->getCache()->getNumericStorageId();
                $result['item_source'] = $path->getId();
                $result['file_source'] = $path->getId();
                $result['file_parent'] = $path->getParent()->getId();
index 2d69636541e46a2b15edd4007c61dd1318c9b0da..74a5d0752a416b09f74d021af585d634e0a713bb 100644 (file)
@@ -172,8 +172,18 @@ class Share20OCSTest extends \Test\TestCase {
                $group = $this->getMock('OCP\IGroup');
                $group->method('getGID')->willReturn('groupId');
 
-               $storage = $this->getMock('OCP\Files\Storage');
+               $cache = $this->getMockBuilder('OC\Files\Cache\Cache')
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $cache->method('getNumericStorageId')->willReturn(101);
+
+               $storage = $this->getMockBuilder('OC\Files\Storage\Storage')
+                       ->disableOriginalConstructor()
+                       ->getMock();
                $storage->method('getId')->willReturn('STORAGE');
+               $storage->method('getCache')->willReturn($cache);
+
+
 
                $parentFolder = $this->getMock('OCP\Files\Folder');
                $parentFolder->method('getId')->willReturn(3);
@@ -224,7 +234,7 @@ class Share20OCSTest extends \Test\TestCase {
                        'parent' => 6,
                        'storage_id' => 'STORAGE',
                        'path' => 'file',
-                       'storage' => null, // HACK around static function
+                       'storage' => 101,
                        'mail_send' => 0,
                ];
                $data[] = [$share, $expected];
@@ -263,7 +273,7 @@ class Share20OCSTest extends \Test\TestCase {
                        'parent' => 6,
                        'storage_id' => 'STORAGE',
                        'path' => 'folder',
-                       'storage' => null, // HACK around static function
+                       'storage' => 101,
                        'mail_send' => 0,
                ];
                $data[] = [$share, $expected];
@@ -305,7 +315,7 @@ class Share20OCSTest extends \Test\TestCase {
                        'parent' => 6,
                        'storage_id' => 'STORAGE',
                        'path' => 'folder',
-                       'storage' => null, // HACK around static function
+                       'storage' => 101,
                        'mail_send' => 0,
                        'url' => 'url',
                ];