adjust tests

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2021-01-26 15:48:04 +01:00 committed by Daniel Kesselberg
parent b9b2c6d2fa
commit 1d1d4de991
No known key found for this signature in database
GPG Key ID: 36E3664E099D0614
3 changed files with 17 additions and 5 deletions

View File

@ -232,7 +232,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);

View 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;

View 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 Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent;
@ -54,6 +55,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')
@ -61,7 +65,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');
@ -91,6 +96,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')
@ -98,7 +106,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');
@ -142,6 +151,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')
@ -149,7 +161,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');