Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adjust tests
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and kesselb committed Mar 16, 2021
commit 1d1d4de991541508181d2ac21fbc09e3e60e151a
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Wrapper/CacheJail.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function getStatus($file) {
}

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);
Expand Down
1 change: 0 additions & 1 deletion lib/private/Share20/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 16 additions & 3 deletions tests/lib/Share20/LegacyHooksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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;
Expand Down Expand Up @@ -54,14 +55,18 @@ public function testPreUnshare() {
$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')
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->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');
Expand Down Expand Up @@ -91,14 +96,18 @@ public function testPostUnshare() {
$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')
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->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');
Expand Down Expand Up @@ -142,14 +151,18 @@ public function testPostUnshareFromSelf() {
$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')
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->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');
Expand Down