|
|
@@ -221,7 +221,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
|
|
|
|
$share = $this->newShare(); |
|
|
|
$share->setNode($node); |
|
|
|
|
|
|
|
|
|
|
|
$this->shareManager |
|
|
|
->expects($this->once()) |
|
|
|
->method('getShareById') |
|
|
@@ -237,7 +237,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
->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])); |
|
|
|
|
|
|
@@ -245,7 +245,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 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(); |
|
|
@@ -254,7 +254,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
$share->setSharedWith($this->currentUser) |
|
|
|
->setShareType(\OCP\Share::SHARE_TYPE_USER) |
|
|
|
->setNode($node); |
|
|
|
|
|
|
|
|
|
|
|
$this->shareManager |
|
|
|
->expects($this->once()) |
|
|
|
->method('getShareById') |
|
|
@@ -269,7 +269,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
$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])); |
|
|
|
|
|
|
@@ -300,7 +300,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
$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])); |
|
|
|
|
|
|
@@ -332,7 +332,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
$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])); |
|
|
|
|
|
|
@@ -388,10 +388,10 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
$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])); |
|
|
|
|
|
|
@@ -448,10 +448,10 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
|
|
|
|
$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])); |
|
|
|
|
|
|
@@ -1602,7 +1602,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
->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); |
|
|
@@ -1634,7 +1634,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
->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); |
|
|
@@ -1682,7 +1682,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
->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); |
|
|
@@ -1736,7 +1736,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
->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); |
|
|
@@ -1791,7 +1791,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
->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); |
|
|
@@ -1843,7 +1843,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
->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); |
|
|
@@ -1875,7 +1875,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
])); |
|
|
|
|
|
|
|
$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); |
|
|
@@ -1894,7 +1894,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
*/ |
|
|
|
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); |
|
|
@@ -1914,7 +1914,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
*/ |
|
|
|
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); |
|
|
@@ -1933,7 +1933,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
$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); |
|
|
@@ -1967,7 +1967,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
$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); |
|
|
@@ -2001,7 +2001,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
$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); |
|
|
@@ -2042,7 +2042,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
$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); |
|
|
@@ -2076,7 +2076,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
])); |
|
|
|
|
|
|
|
$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); |
|
|
@@ -2117,7 +2117,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
$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); |
|
|
@@ -2145,7 +2145,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
->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); |
|
|
@@ -2227,7 +2227,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
->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); |
|
|
@@ -2268,7 +2268,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
->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); |
|
|
@@ -2345,7 +2345,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
->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); |
|
|
@@ -3381,7 +3381,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
|
|
|
|
$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); |
|
|
|
|
|
|
@@ -4150,7 +4150,7 @@ class ShareAPIControllerTest extends TestCase { |
|
|
|
|
|
|
|
$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); |
|
|
|
|