Fix tests

Signed-off-by: Tobia De Koninck <LEDfan@users.noreply.github.com>
This commit is contained in:
Tobia De Koninck 2019-07-18 10:35:57 +02:00
parent 5fb6e9e2a7
commit 061a919623
1 changed files with 7 additions and 3 deletions

View File

@ -21,7 +21,6 @@
namespace Test\Share20;
use OC\Files\Mount\MoveableMount;
use OC\HintException;
use OC\Share20\DefaultShareProvider;
use OC\Share20\Exception;
@ -53,11 +52,13 @@ use OCP\Security\ISecureRandom;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IProviderFactory;
use OCP\Share\IShare;
use OC\Files\Mount\MountPoint;
use OCP\Share\IShareProvider;
use PHPUnit\Framework\MockObject\MockBuilder;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Test\TestMoveableMountPoint;
/**
* Class ManagerTest
@ -624,8 +625,8 @@ class ManagerTest extends \Test\TestCase {
$data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, null, null, null), 'A share requires permissions', true];
$data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user0, $user0, null, null, null), 'A share requires permissions', true];
$mount = $this->createMock(MoveableMount::class);
$limitedPermssions->method('getMountPoint')->willReturn($mount);
$movableMount = $this->createMock(TestMoveableMountPoint::class);
$limitedPermssions->method('getMountPoint')->willReturn($movableMount);
$data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user0, $user0, 31, null, null), 'Cant increase permissions of path', true];
@ -640,6 +641,8 @@ class ManagerTest extends \Test\TestCase {
->willReturn($owner);
$nonMoveableMountPermssions->method('getStorage')
->willReturn($storage);
$nonMoveableMountPoint = $this->createMock(MountPoint::class);
$nonMoveableMountPermssions->method('getMountPoint')->willReturn($nonMoveableMountPoint);
$data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $nonMoveableMountPermssions, $user2, $user0, $user0, 11, null, null), 'Cant increase permissions of path', false];
$data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $nonMoveableMountPermssions, $group0, $user0, $user0, 11, null, null), 'Cant increase permissions of path', false];
@ -660,6 +663,7 @@ class ManagerTest extends \Test\TestCase {
->willReturn($owner);
$allPermssions->method('getStorage')
->willReturn($storage);
$allPermssions->method('getMountPoint')->willReturn($movableMount);
$data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $allPermssions, $user2, $user0, $user0, 30, null, null), 'Shares need at least read permissions', true];
$data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 2, null, null), 'Shares need at least read permissions', true];