]> source.dussan.org Git - nextcloud-server.git/commitdiff
adjust tests
authorRobin Appelman <robin@icewind.nl>
Tue, 26 Jan 2021 14:48:04 +0000 (15:48 +0100)
committerDaniel Kesselberg <mail@danielkesselberg.de>
Tue, 16 Mar 2021 14:22:23 +0000 (15:22 +0100)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Cache/Wrapper/CacheJail.php
lib/private/Share20/Share.php
tests/lib/Share20/LegacyHooksTest.php

index d8e2efb2daad9675c3fb197ec296b3330ac77e45..c1e7b285dcfc1f6e23004d90c63cd12afc1e87bb 100644 (file)
@@ -231,7 +231,7 @@ class CacheJail extends CacheWrapper {
        }
 
        private function formatSearchResults($results) {
-               return array_map(function($entry) {
+               return array_map(function ($entry) {
                        $entry['path'] = $this->getJailedPath($entry['path'], $this->getGetUnjailedRoot());
                        return $entry;
                }, $results);
index 9b782d5a446e3b760c70d454b88f603790583e07..a4fbf05141376aa1284c89e99e4f84c02a281fd2 100644 (file)
@@ -31,7 +31,6 @@
 namespace OC\Share20;
 
 use OCP\Files\Cache\ICacheEntry;
-use OCP\Files\File;
 use OCP\Files\FileInfo;
 use OCP\Files\IRootFolder;
 use OCP\Files\Node;
index 66dbafe76919f4e9558ccb7742ae84bd5d72f370..a615e26afb0711e24de025dbd63e0481bb9fbf3c 100644 (file)
@@ -26,6 +26,7 @@ namespace Test\Share20;
 use OC\Share20\LegacyHooks;
 use OC\Share20\Manager;
 use OCP\Constants;
+use OCP\Files\Cache\ICacheEntry;
 use OCP\Files\File;
 use OCP\Share\IShare;
 use Symfony\Component\EventDispatcher\EventDispatcher;
@@ -55,6 +56,9 @@ class LegacyHooksTest extends TestCase {
                $path = $this->createMock(File::class);
                $path->method('getId')->willReturn(1);
 
+               $info = $this->createMock(ICacheEntry::class);
+               $info->method('getMimeType')->willReturn('text/plain');
+
                $share = $this->manager->newShare();
                $share->setId(42)
                        ->setProviderId('prov')
@@ -62,7 +66,8 @@ class LegacyHooksTest extends TestCase {
                        ->setSharedWith('awesomeUser')
                        ->setSharedBy('sharedBy')
                        ->setNode($path)
-                       ->setTarget('myTarget');
+                       ->setTarget('myTarget')
+                       ->setNodeCacheEntry($info);
 
                $hookListner = $this->getMockBuilder('Dummy')->setMethods(['pre'])->getMock();
                \OCP\Util::connectHook('OCP\Share', 'pre_unshare', $hookListner, 'pre');
@@ -92,6 +97,9 @@ class LegacyHooksTest extends TestCase {
                $path = $this->createMock(File::class);
                $path->method('getId')->willReturn(1);
 
+               $info = $this->createMock(ICacheEntry::class);
+               $info->method('getMimeType')->willReturn('text/plain');
+
                $share = $this->manager->newShare();
                $share->setId(42)
                        ->setProviderId('prov')
@@ -99,7 +107,8 @@ class LegacyHooksTest extends TestCase {
                        ->setSharedWith('awesomeUser')
                        ->setSharedBy('sharedBy')
                        ->setNode($path)
-                       ->setTarget('myTarget');
+                       ->setTarget('myTarget')
+                       ->setNodeCacheEntry($info);
 
                $hookListner = $this->getMockBuilder('Dummy')->setMethods(['post'])->getMock();
                \OCP\Util::connectHook('OCP\Share', 'post_unshare', $hookListner, 'post');
@@ -143,6 +152,9 @@ class LegacyHooksTest extends TestCase {
                $path = $this->createMock(File::class);
                $path->method('getId')->willReturn(1);
 
+               $info = $this->createMock(ICacheEntry::class);
+               $info->method('getMimeType')->willReturn('text/plain');
+
                $share = $this->manager->newShare();
                $share->setId(42)
                        ->setProviderId('prov')
@@ -150,7 +162,8 @@ class LegacyHooksTest extends TestCase {
                        ->setSharedWith('awesomeUser')
                        ->setSharedBy('sharedBy')
                        ->setNode($path)
-                       ->setTarget('myTarget');
+                       ->setTarget('myTarget')
+                       ->setNodeCacheEntry($info);
 
                $hookListner = $this->getMockBuilder('Dummy')->setMethods(['postFromSelf'])->getMock();
                \OCP\Util::connectHook('OCP\Share', 'post_unshareFromSelf', $hookListner, 'postFromSelf');