adjust tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
ec0985ba68
commit
c727879073
|
@ -231,7 +231,7 @@ class CacheJail extends CacheWrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function formatSearchResults($results) {
|
private function formatSearchResults($results) {
|
||||||
return array_map(function($entry) {
|
return array_map(function ($entry) {
|
||||||
$entry['path'] = $this->getJailedPath($entry['path'], $this->getGetUnjailedRoot());
|
$entry['path'] = $this->getJailedPath($entry['path'], $this->getGetUnjailedRoot());
|
||||||
return $entry;
|
return $entry;
|
||||||
}, $results);
|
}, $results);
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
namespace OC\Share20;
|
namespace OC\Share20;
|
||||||
|
|
||||||
use OCP\Files\Cache\ICacheEntry;
|
use OCP\Files\Cache\ICacheEntry;
|
||||||
use OCP\Files\File;
|
|
||||||
use OCP\Files\FileInfo;
|
use OCP\Files\FileInfo;
|
||||||
use OCP\Files\IRootFolder;
|
use OCP\Files\IRootFolder;
|
||||||
use OCP\Files\Node;
|
use OCP\Files\Node;
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace Test\Share20;
|
||||||
use OC\Share20\LegacyHooks;
|
use OC\Share20\LegacyHooks;
|
||||||
use OC\Share20\Manager;
|
use OC\Share20\Manager;
|
||||||
use OCP\Constants;
|
use OCP\Constants;
|
||||||
|
use OCP\Files\Cache\ICacheEntry;
|
||||||
use OCP\Files\File;
|
use OCP\Files\File;
|
||||||
use OCP\Share\IShare;
|
use OCP\Share\IShare;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
|
@ -55,6 +56,9 @@ class LegacyHooksTest extends TestCase {
|
||||||
$path = $this->createMock(File::class);
|
$path = $this->createMock(File::class);
|
||||||
$path->method('getId')->willReturn(1);
|
$path->method('getId')->willReturn(1);
|
||||||
|
|
||||||
|
$info = $this->createMock(ICacheEntry::class);
|
||||||
|
$info->method('getMimeType')->willReturn('text/plain');
|
||||||
|
|
||||||
$share = $this->manager->newShare();
|
$share = $this->manager->newShare();
|
||||||
$share->setId(42)
|
$share->setId(42)
|
||||||
->setProviderId('prov')
|
->setProviderId('prov')
|
||||||
|
@ -62,7 +66,8 @@ class LegacyHooksTest extends TestCase {
|
||||||
->setSharedWith('awesomeUser')
|
->setSharedWith('awesomeUser')
|
||||||
->setSharedBy('sharedBy')
|
->setSharedBy('sharedBy')
|
||||||
->setNode($path)
|
->setNode($path)
|
||||||
->setTarget('myTarget');
|
->setTarget('myTarget')
|
||||||
|
->setNodeCacheEntry($info);
|
||||||
|
|
||||||
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['pre'])->getMock();
|
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['pre'])->getMock();
|
||||||
\OCP\Util::connectHook('OCP\Share', 'pre_unshare', $hookListner, 'pre');
|
\OCP\Util::connectHook('OCP\Share', 'pre_unshare', $hookListner, 'pre');
|
||||||
|
@ -92,6 +97,9 @@ class LegacyHooksTest extends TestCase {
|
||||||
$path = $this->createMock(File::class);
|
$path = $this->createMock(File::class);
|
||||||
$path->method('getId')->willReturn(1);
|
$path->method('getId')->willReturn(1);
|
||||||
|
|
||||||
|
$info = $this->createMock(ICacheEntry::class);
|
||||||
|
$info->method('getMimeType')->willReturn('text/plain');
|
||||||
|
|
||||||
$share = $this->manager->newShare();
|
$share = $this->manager->newShare();
|
||||||
$share->setId(42)
|
$share->setId(42)
|
||||||
->setProviderId('prov')
|
->setProviderId('prov')
|
||||||
|
@ -99,7 +107,8 @@ class LegacyHooksTest extends TestCase {
|
||||||
->setSharedWith('awesomeUser')
|
->setSharedWith('awesomeUser')
|
||||||
->setSharedBy('sharedBy')
|
->setSharedBy('sharedBy')
|
||||||
->setNode($path)
|
->setNode($path)
|
||||||
->setTarget('myTarget');
|
->setTarget('myTarget')
|
||||||
|
->setNodeCacheEntry($info);
|
||||||
|
|
||||||
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['post'])->getMock();
|
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['post'])->getMock();
|
||||||
\OCP\Util::connectHook('OCP\Share', 'post_unshare', $hookListner, 'post');
|
\OCP\Util::connectHook('OCP\Share', 'post_unshare', $hookListner, 'post');
|
||||||
|
@ -143,6 +152,9 @@ class LegacyHooksTest extends TestCase {
|
||||||
$path = $this->createMock(File::class);
|
$path = $this->createMock(File::class);
|
||||||
$path->method('getId')->willReturn(1);
|
$path->method('getId')->willReturn(1);
|
||||||
|
|
||||||
|
$info = $this->createMock(ICacheEntry::class);
|
||||||
|
$info->method('getMimeType')->willReturn('text/plain');
|
||||||
|
|
||||||
$share = $this->manager->newShare();
|
$share = $this->manager->newShare();
|
||||||
$share->setId(42)
|
$share->setId(42)
|
||||||
->setProviderId('prov')
|
->setProviderId('prov')
|
||||||
|
@ -150,7 +162,8 @@ class LegacyHooksTest extends TestCase {
|
||||||
->setSharedWith('awesomeUser')
|
->setSharedWith('awesomeUser')
|
||||||
->setSharedBy('sharedBy')
|
->setSharedBy('sharedBy')
|
||||||
->setNode($path)
|
->setNode($path)
|
||||||
->setTarget('myTarget');
|
->setTarget('myTarget')
|
||||||
|
->setNodeCacheEntry($info);
|
||||||
|
|
||||||
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['postFromSelf'])->getMock();
|
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['postFromSelf'])->getMock();
|
||||||
\OCP\Util::connectHook('OCP\Share', 'post_unshareFromSelf', $hookListner, 'postFromSelf');
|
\OCP\Util::connectHook('OCP\Share', 'post_unshareFromSelf', $hookListner, 'postFromSelf');
|
||||||
|
|
Loading…
Reference in New Issue