$share = $this->newShare();
$share->setNode($node);
-
+
$this->shareManager
->expects($this->once())
->method('getShareById')
->method('lock')
->with(\OCP\Lock\ILockingProvider::LOCK_SHARED)
->will($this->throwException(new LockedException('mypath')));
-
+
$this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteFromSelf', [$share]));
$this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteShare', [$share]));
}
/**
- * You can always remove a share that was shared with you
+ * You can always remove a share that was shared with you
*/
public function testDeleteShareWithMe() {
$node = $this->getMockBuilder(File::class)->getMock();
$share->setSharedWith($this->currentUser)
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setNode($node);
-
+
$this->shareManager
->expects($this->once())
->method('getShareById')
$node->expects($this->once())
->method('lock')
->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
-
+
$this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteFromSelf', [$share]));
$this->assertTrue($this->invokePrivate($this->ocs, 'canDeleteShare', [$share]));
$node->expects($this->once())
->method('lock')
->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
-
+
$this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteFromSelf', [$share]));
$this->assertTrue($this->invokePrivate($this->ocs, 'canDeleteShare', [$share]));
$node->expects($this->once())
->method('lock')
->with(\OCP\Lock\ILockingProvider::LOCK_SHARED);
-
+
$this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteFromSelf', [$share]));
$this->assertTrue($this->invokePrivate($this->ocs, 'canDeleteShare', [$share]));
$this->shareManager->expects($this->once())
->method('deleteFromSelf')
->with($share, $this->currentUser);
-
+
$this->shareManager->expects($this->never())
->method('deleteShare');
-
+
$this->assertTrue($this->invokePrivate($this->ocs, 'canDeleteShareFromSelf', [$share]));
$this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteShare', [$share]));
$this->shareManager->expects($this->never())
->method('deleteFromSelf');
-
+
$this->shareManager->expects($this->never())
->method('deleteShare');
-
+
$this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteShareFromSelf', [$share]));
$this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteShare', [$share]));
->willReturn($userFolder);
$path = $this->getMockBuilder(File::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
->willReturn($userFolder);
$path = $this->getMockBuilder(File::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
->willReturn($userFolder);
$path = $this->getMockBuilder(File::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
->willReturn($userFolder);
$path = $this->getMockBuilder(File::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
->willReturn($userFolder);
$path = $this->getMockBuilder(Folder::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
->willReturn($userFolder);
$path = $this->getMockBuilder(Folder::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
]));
$path = $this->getMockBuilder(Folder::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
*/
public function testCreateShareLinkNoPublicUpload() {
$path = $this->getMockBuilder(Folder::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
*/
public function testCreateShareLinkPublicUploadFile() {
$path = $this->getMockBuilder(File::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$ocs = $this->mockFormatShare();
$path = $this->getMockBuilder(Folder::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$ocs = $this->mockFormatShare();
$path = $this->getMockBuilder(Folder::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$ocs = $this->mockFormatShare();
$path = $this->getMockBuilder(Folder::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$ocs = $this->mockFormatShare();
$path = $this->getMockBuilder(Folder::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
]));
$path = $this->getMockBuilder(Folder::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$ocs = $this->mockFormatShare();
$path = $this->getMockBuilder(Folder::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
->willReturn($userFolder);
$path = $this->getMockBuilder(File::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
->willReturn($userFolder);
$path = $this->getMockBuilder(File::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
->willReturn($userFolder);
$path = $this->getMockBuilder(File::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
->willReturn($userFolder);
$path = $this->getMockBuilder(Folder::class)->getMock();
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(true);
$cache = $this->getMockBuilder('OCP\Files\Cache\ICache')->getMock();
$cache->method('getNumericStorageId')->willReturn(100);
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('storageId');
$storage->method('getCache')->willReturn($cache);
$cache = $this->getMockBuilder('OCP\Files\Cache\ICache')->getMock();
$cache->method('getNumericStorageId')->willReturn(100);
- $storage = $this->getMockBuilder(Storage::class)->getMock();
+ $storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('storageId');
$storage->method('getCache')->willReturn($cache);