|
@@ -367,6 +367,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
*/
|
|
|
public function testDeleteShareFileOwner() {
|
|
|
$node = $this->getMockBuilder(File::class)->getMock();
|
|
|
+ $node->method('getId')->willReturn(1);
|
|
|
|
|
|
$share = $this->newShare();
|
|
|
$share->setShareOwner($this->currentUser)
|
|
@@ -399,6 +400,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
*/
|
|
|
public function testDeleteSharedWithMyGroup() {
|
|
|
$node = $this->getMockBuilder(File::class)->getMock();
|
|
|
+ $node->method('getId')->willReturn(1);
|
|
|
|
|
|
$share = $this->newShare();
|
|
|
$share->setShareType(IShare::TYPE_GROUP)
|
|
@@ -435,9 +437,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with($share->getNodeId())
|
|
|
- ->willReturn([$share->getNode()]);
|
|
|
+ ->willReturn($share->getNode());
|
|
|
|
|
|
$this->shareManager->expects($this->once())
|
|
|
->method('deleteFromSelf')
|
|
@@ -461,6 +463,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$this->expectExceptionMessage('Wrong share ID, share does not exist');
|
|
|
|
|
|
$node = $this->getMockBuilder(File::class)->getMock();
|
|
|
+ $node->method('getId')->willReturn(42);
|
|
|
|
|
|
$share = $this->newShare();
|
|
|
$share->setShareType(IShare::TYPE_GROUP)
|
|
@@ -497,9 +500,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with($share->getNodeId())
|
|
|
- ->willReturn([$share->getNode()]);
|
|
|
+ ->willReturn($share->getNode());
|
|
|
|
|
|
$this->shareManager->expects($this->never())
|
|
|
->method('deleteFromSelf');
|
|
@@ -813,6 +816,10 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($share->getNodeId())
|
|
|
->willReturn([$share->getNode()]);
|
|
|
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
+ ->with($share->getNodeId())
|
|
|
+ ->willReturn($share->getNode());
|
|
|
+
|
|
|
$this->rootFolder->method('getUserFolder')
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
@@ -1497,9 +1504,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with($share->getNodeId())
|
|
|
- ->willReturn([$file]);
|
|
|
+ ->willReturn($file);
|
|
|
|
|
|
$file->method('getPermissions')
|
|
|
->will($this->onConsecutiveCalls(\OCP\Constants::PERMISSION_SHARE, \OCP\Constants::PERMISSION_READ));
|
|
@@ -1593,9 +1600,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with($share->getNodeId())
|
|
|
- ->willReturn([$share->getNode()]);
|
|
|
+ ->willReturn($share->getNode());
|
|
|
|
|
|
if (!$helperAvailable) {
|
|
|
$this->appManager->method('isEnabledForUser')
|
|
@@ -1947,6 +1954,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
]);
|
|
|
|
|
|
$path = $this->getMockBuilder(Folder::class)->getMock();
|
|
|
+ $path->method('getId')->willReturn(42);
|
|
|
$storage = $this->createMock(Storage::class);
|
|
|
$storage->method('instanceOfStorage')
|
|
|
->willReturnMap([
|
|
@@ -1970,6 +1978,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$this->expectExceptionMessage('Public upload disabled by the administrator');
|
|
|
|
|
|
$path = $this->getMockBuilder(Folder::class)->getMock();
|
|
|
+ $path->method('getId')->willReturn(42);
|
|
|
$storage = $this->createMock(Storage::class);
|
|
|
$storage->method('instanceOfStorage')
|
|
|
->willReturnMap([
|
|
@@ -1994,6 +2003,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$this->expectExceptionMessage('Public upload is only possible for publicly shared folders');
|
|
|
|
|
|
$path = $this->getMockBuilder(File::class)->getMock();
|
|
|
+ $path->method('getId')->willReturn(42);
|
|
|
$storage = $this->createMock(Storage::class);
|
|
|
$storage->method('instanceOfStorage')
|
|
|
->willReturnMap([
|
|
@@ -2017,6 +2027,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$ocs = $this->mockFormatShare();
|
|
|
|
|
|
$path = $this->getMockBuilder(Folder::class)->getMock();
|
|
|
+ $path->method('getId')->willReturn(1);
|
|
|
$storage = $this->createMock(Storage::class);
|
|
|
$storage->method('instanceOfStorage')
|
|
|
->willReturnMap([
|
|
@@ -2055,6 +2066,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$ocs = $this->mockFormatShare();
|
|
|
|
|
|
$path = $this->getMockBuilder(Folder::class)->getMock();
|
|
|
+ $path->method('getId')->willReturn(42);
|
|
|
$storage = $this->createMock(Storage::class);
|
|
|
$storage->method('instanceOfStorage')
|
|
|
->willReturnMap([
|
|
@@ -2093,6 +2105,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$ocs = $this->mockFormatShare();
|
|
|
|
|
|
$path = $this->getMockBuilder(Folder::class)->getMock();
|
|
|
+ $path->method('getId')->willReturn(42);
|
|
|
$storage = $this->createMock(Storage::class);
|
|
|
$storage->method('instanceOfStorage')
|
|
|
->willReturnMap([
|
|
@@ -2138,6 +2151,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$ocs = $this->mockFormatShare();
|
|
|
|
|
|
$path = $this->getMockBuilder(Folder::class)->getMock();
|
|
|
+ $path->method('getId')->willReturn(42);
|
|
|
$storage = $this->createMock(Storage::class);
|
|
|
$storage->method('instanceOfStorage')
|
|
|
->willReturnMap([
|
|
@@ -2176,6 +2190,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
]);
|
|
|
|
|
|
$path = $this->getMockBuilder(Folder::class)->getMock();
|
|
|
+ $path->method('getId')->willReturn(42);
|
|
|
$storage = $this->createMock(Storage::class);
|
|
|
$storage->method('instanceOfStorage')
|
|
|
->willReturnMap([
|
|
@@ -2221,6 +2236,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$ocs = $this->mockFormatShare();
|
|
|
|
|
|
$path = $this->getMockBuilder(Folder::class)->getMock();
|
|
|
+ $path->method('getId')->willReturn(42);
|
|
|
$storage = $this->createMock(Storage::class);
|
|
|
$storage->method('instanceOfStorage')
|
|
|
->willReturnMap([
|
|
@@ -2579,6 +2595,8 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
$path = $this->getMockBuilder(Folder::class)->getMock();
|
|
|
+ $path->method('getId')->willReturn(42);
|
|
|
+
|
|
|
$storage = $this->createMock(Storage::class);
|
|
|
$storage->method('instanceOfStorage')
|
|
|
->willReturnMap([
|
|
@@ -2628,9 +2646,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with($share->getNodeId())
|
|
|
- ->willReturn([$share->getNode()]);
|
|
|
+ ->willReturn($share->getNode());
|
|
|
|
|
|
$this->ocs->updateShare(42);
|
|
|
}
|
|
@@ -2721,9 +2739,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$node]);
|
|
|
+ ->willReturn($node);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$node->method('getMountPoint')
|
|
@@ -2775,9 +2793,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$folder]);
|
|
|
+ ->willReturn($folder);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$folder->method('getMountPoint')
|
|
@@ -2825,9 +2843,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$folder]);
|
|
|
+ ->willReturn($folder);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$folder->method('getMountPoint')
|
|
@@ -2883,9 +2901,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$folder]);
|
|
|
+ ->willReturn($folder);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$folder->method('getMountPoint')
|
|
@@ -2941,9 +2959,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
|
|
|
$ocs = $this->mockFormatShare();
|
|
|
[$userFolder, $folder] = $this->getNonSharedUserFolder();
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$folder]);
|
|
|
+ ->willReturn($folder);
|
|
|
$this->rootFolder->method('getUserFolder')
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
@@ -2988,9 +3006,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
|
|
|
$ocs = $this->mockFormatShare();
|
|
|
[$userFolder, $folder] = $this->getNonSharedUserFolder();
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$folder]);
|
|
|
+ ->willReturn($folder);
|
|
|
$this->rootFolder->method('getUserFolder')
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
@@ -3020,9 +3038,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$file->method('getId')
|
|
|
->willReturn(42);
|
|
|
[$userFolder, $folder] = $this->getNonSharedUserFolder();
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$folder]);
|
|
|
+ ->willReturn($folder);
|
|
|
$this->rootFolder->method('getUserFolder')
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
@@ -3047,9 +3065,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
|
|
|
[$userFolder, $node] = $this->getNonSharedUserFolder();
|
|
|
$node->method('getId')->willReturn(42);
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$node]);
|
|
|
+ ->willReturn($node);
|
|
|
$this->rootFolder->method('getUserFolder')
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
@@ -3098,9 +3116,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$date->setTime(0, 0, 0);
|
|
|
|
|
|
[$userFolder, $node] = $this->getNonSharedUserFolder();
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$node]);
|
|
|
+ ->willReturn($node);
|
|
|
$this->rootFolder->method('getUserFolder')
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
@@ -3156,9 +3174,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$date->setTime(0, 0, 0);
|
|
|
|
|
|
[$userFolder, $node] = $this->getNonSharedUserFolder();
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$node]);
|
|
|
+ ->willReturn($node);
|
|
|
$this->rootFolder->method('getUserFolder')
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
@@ -3196,9 +3214,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$date->setTime(0, 0, 0);
|
|
|
|
|
|
[$userFolder, $node] = $this->getNonSharedUserFolder();
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$node]);
|
|
|
+ ->willReturn($node);
|
|
|
$this->rootFolder->method('getUserFolder')
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
@@ -3290,9 +3308,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$node]);
|
|
|
+ ->willReturn($node);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$node->method('getMountPoint')
|
|
@@ -3358,9 +3376,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$node]);
|
|
|
+ ->willReturn($node);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$node->method('getMountPoint')
|
|
@@ -3419,9 +3437,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$folder]);
|
|
|
+ ->willReturn($folder);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$folder->method('getMountPoint')
|
|
@@ -3479,9 +3497,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$folder]);
|
|
|
+ ->willReturn($folder);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$folder->method('getMountPoint')
|
|
@@ -3537,9 +3555,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$folder]);
|
|
|
+ ->willReturn($folder);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$folder->method('getMountPoint')
|
|
@@ -3585,9 +3603,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$file]);
|
|
|
+ ->willReturn($file);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$file->method('getMountPoint')
|
|
@@ -3651,9 +3669,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$folder]);
|
|
|
+ ->willReturn($folder);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$folder->method('getMountPoint')
|
|
@@ -3721,9 +3739,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturn($userFolder);
|
|
|
|
|
|
- $userFolder->method('getById')
|
|
|
+ $userFolder->method('getFirstNodeById')
|
|
|
->with(42)
|
|
|
- ->willReturn([$folder]);
|
|
|
+ ->willReturn($folder);
|
|
|
|
|
|
$mountPoint = $this->createMock(IMountPoint::class);
|
|
|
$folder->method('getMountPoint')
|
|
@@ -4651,9 +4669,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
$this->dateTimeZone->method('getTimezone')->willReturn(new \DateTimeZone('UTC'));
|
|
|
|
|
|
if (!$exception) {
|
|
|
- $this->rootFolder->method('getById')
|
|
|
+ $this->rootFolder->method('getFirstNodeById')
|
|
|
->with($share->getNodeId())
|
|
|
- ->willReturn([$share->getNode()]);
|
|
|
+ ->willReturn($share->getNode());
|
|
|
|
|
|
$this->rootFolder->method('getRelativePath')
|
|
|
->with($share->getNode()->getPath())
|
|
@@ -4846,9 +4864,9 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
->with($this->currentUser)
|
|
|
->willReturnSelf();
|
|
|
|
|
|
- $this->rootFolder->method('getById')
|
|
|
+ $this->rootFolder->method('getFirstNodeById')
|
|
|
->with($share->getNodeId())
|
|
|
- ->willReturn([$share->getNode()]);
|
|
|
+ ->willReturn($share->getNode());
|
|
|
|
|
|
$this->rootFolder->method('getRelativePath')
|
|
|
->with($share->getNode()->getPath())
|
|
@@ -4890,6 +4908,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
]);
|
|
|
$userFolder->method('getStorage')->willReturn($storage);
|
|
|
$node->method('getStorage')->willReturn($storage);
|
|
|
+ $node->method('getId')->willReturn(42);
|
|
|
return [$userFolder, $node];
|
|
|
}
|
|
|
|
|
@@ -4904,6 +4923,7 @@ class ShareAPIControllerTest extends TestCase {
|
|
|
]);
|
|
|
$userFolder->method('getStorage')->willReturn($storage);
|
|
|
$node->method('getStorage')->willReturn($storage);
|
|
|
+ $node->method('getId')->willReturn(42);
|
|
|
return [$userFolder, $node];
|
|
|
}
|
|
|
}
|