|
|
|
@ -125,7 +125,7 @@ class ApiTest extends TestCase { |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testCreateShareUserFile() { |
|
|
|
|
public function testCreateShareUserFile(): void { |
|
|
|
|
$this->setUp(); // for some reasons phpunit refuses to do this for us only for this test |
|
|
|
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
|
|
|
|
$result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); |
|
|
|
@ -143,7 +143,7 @@ class ApiTest extends TestCase { |
|
|
|
|
$ocs->cleanup(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testCreateShareUserFolder() { |
|
|
|
|
public function testCreateShareUserFolder(): void { |
|
|
|
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
|
|
|
|
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); |
|
|
|
|
$ocs->cleanup(); |
|
|
|
@ -160,7 +160,7 @@ class ApiTest extends TestCase { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function testCreateShareGroupFile() { |
|
|
|
|
public function testCreateShareGroupFile(): void { |
|
|
|
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
|
|
|
|
$result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); |
|
|
|
|
$ocs->cleanup(); |
|
|
|
@ -176,7 +176,7 @@ class ApiTest extends TestCase { |
|
|
|
|
$ocs->cleanup(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testCreateShareGroupFolder() { |
|
|
|
|
public function testCreateShareGroupFolder(): void { |
|
|
|
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
|
|
|
|
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); |
|
|
|
|
$ocs->cleanup(); |
|
|
|
@ -195,7 +195,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* @group RoutingWeirdness |
|
|
|
|
*/ |
|
|
|
|
public function testCreateShareLink() { |
|
|
|
|
public function testCreateShareLink(): void { |
|
|
|
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
|
|
|
|
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); |
|
|
|
|
$ocs->cleanup(); |
|
|
|
@ -220,7 +220,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* @group RoutingWeirdness |
|
|
|
|
*/ |
|
|
|
|
public function testCreateShareLinkPublicUpload() { |
|
|
|
|
public function testCreateShareLinkPublicUpload(): void { |
|
|
|
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
|
|
|
|
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true'); |
|
|
|
|
$ocs->cleanup(); |
|
|
|
@ -248,7 +248,7 @@ class ApiTest extends TestCase { |
|
|
|
|
$ocs->cleanup(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testEnforceLinkPassword() { |
|
|
|
|
public function testEnforceLinkPassword(): void { |
|
|
|
|
$password = md5(time()); |
|
|
|
|
$config = \OC::$server->getConfig(); |
|
|
|
|
$config->setAppValue('core', 'shareapi_enforce_links_password', 'yes'); |
|
|
|
@ -302,7 +302,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* @medium |
|
|
|
|
*/ |
|
|
|
|
public function testSharePermissions() { |
|
|
|
|
public function testSharePermissions(): void { |
|
|
|
|
// sharing file to a user should work if shareapi_exclude_groups is set |
|
|
|
|
// to no |
|
|
|
|
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no'); |
|
|
|
@ -353,7 +353,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* @medium |
|
|
|
|
*/ |
|
|
|
|
public function testGetAllShares() { |
|
|
|
|
public function testGetAllShares(): void { |
|
|
|
|
$node = $this->userFolder->get($this->filename); |
|
|
|
|
|
|
|
|
|
$share = $this->shareManager->newShare(); |
|
|
|
@ -374,7 +374,7 @@ class ApiTest extends TestCase { |
|
|
|
|
$this->shareManager->deleteShare($share); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testGetAllSharesWithMe() { |
|
|
|
|
public function testGetAllSharesWithMe(): void { |
|
|
|
|
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); |
|
|
|
|
$this->logout(); |
|
|
|
|
|
|
|
|
@ -414,7 +414,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* @medium |
|
|
|
|
* @group RoutingWeirdness |
|
|
|
|
*/ |
|
|
|
|
public function testPublicLinkUrl() { |
|
|
|
|
public function testPublicLinkUrl(): void { |
|
|
|
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
|
|
|
|
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); |
|
|
|
|
$ocs->cleanup(); |
|
|
|
@ -463,7 +463,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* @depends testCreateShareUserFile |
|
|
|
|
* @depends testCreateShareLink |
|
|
|
|
*/ |
|
|
|
|
public function testGetShareFromSource() { |
|
|
|
|
public function testGetShareFromSource(): void { |
|
|
|
|
$node = $this->userFolder->get($this->filename); |
|
|
|
|
$share = $this->shareManager->newShare(); |
|
|
|
|
$share->setNode($node) |
|
|
|
@ -496,7 +496,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* @depends testCreateShareUserFile |
|
|
|
|
* @depends testCreateShareLink |
|
|
|
|
*/ |
|
|
|
|
public function testGetShareFromSourceWithReshares() { |
|
|
|
|
public function testGetShareFromSourceWithReshares(): void { |
|
|
|
|
$node = $this->userFolder->get($this->filename); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
|
$share1->setNode($node) |
|
|
|
@ -537,7 +537,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* @medium |
|
|
|
|
* @depends testCreateShareUserFile |
|
|
|
|
*/ |
|
|
|
|
public function testGetShareFromId() { |
|
|
|
|
public function testGetShareFromId(): void { |
|
|
|
|
$node = $this->userFolder->get($this->filename); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
|
$share1->setNode($node) |
|
|
|
@ -561,7 +561,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* @medium |
|
|
|
|
*/ |
|
|
|
|
public function testGetShareFromFolder() { |
|
|
|
|
public function testGetShareFromFolder(): void { |
|
|
|
|
$node1 = $this->userFolder->get($this->filename); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
|
$share1->setNode($node1) |
|
|
|
@ -591,7 +591,7 @@ class ApiTest extends TestCase { |
|
|
|
|
$this->shareManager->deleteShare($share2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testGetShareFromFolderWithFile() { |
|
|
|
|
public function testGetShareFromFolderWithFile(): void { |
|
|
|
|
$node1 = $this->userFolder->get($this->filename); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
|
$share1->setNode($node1) |
|
|
|
@ -617,7 +617,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* share a folder, than reshare a file within the shared folder and check if we construct the correct path |
|
|
|
|
* @medium |
|
|
|
|
*/ |
|
|
|
|
public function testGetShareFromFolderReshares() { |
|
|
|
|
public function testGetShareFromFolderReshares(): void { |
|
|
|
|
$node1 = $this->userFolder->get($this->folder); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
|
$share1->setNode($node1) |
|
|
|
@ -677,7 +677,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* reshare a sub folder and check if we get the correct path |
|
|
|
|
* @medium |
|
|
|
|
*/ |
|
|
|
|
public function testGetShareFromSubFolderReShares() { |
|
|
|
|
public function testGetShareFromSubFolderReShares(): void { |
|
|
|
|
$node1 = $this->userFolder->get($this->folder . $this->subfolder); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
|
$share1->setNode($node1) |
|
|
|
@ -796,7 +796,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* test multiple shared folder if the path gets constructed correctly |
|
|
|
|
* @medium |
|
|
|
|
*/ |
|
|
|
|
public function testGetShareMultipleSharedFolder() { |
|
|
|
|
public function testGetShareMultipleSharedFolder(): void { |
|
|
|
|
$this->setUp(); |
|
|
|
|
$node1 = $this->userFolder->get($this->folder . $this->subfolder); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
@ -861,7 +861,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* test re-re-share of folder if the path gets constructed correctly |
|
|
|
|
* @medium |
|
|
|
|
*/ |
|
|
|
|
public function testGetShareFromFileReReShares() { |
|
|
|
|
public function testGetShareFromFileReReShares(): void { |
|
|
|
|
$node1 = $this->userFolder->get($this->folder . $this->subfolder); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
|
$share1->setNode($node1) |
|
|
|
@ -916,7 +916,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* @medium |
|
|
|
|
*/ |
|
|
|
|
public function testGetShareFromUnknownId() { |
|
|
|
|
public function testGetShareFromUnknownId(): void { |
|
|
|
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER3); |
|
|
|
|
try { |
|
|
|
|
$ocs->getShare(0); |
|
|
|
@ -932,7 +932,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* @depends testCreateShareUserFile |
|
|
|
|
* @depends testCreateShareLink |
|
|
|
|
*/ |
|
|
|
|
public function testUpdateShare() { |
|
|
|
|
public function testUpdateShare(): void { |
|
|
|
|
$password = md5(time()); |
|
|
|
|
|
|
|
|
|
$node1 = $this->userFolder->get($this->filename); |
|
|
|
@ -992,7 +992,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* @medium |
|
|
|
|
*/ |
|
|
|
|
public function testUpdateShareUpload() { |
|
|
|
|
public function testUpdateShareUpload(): void { |
|
|
|
|
$node1 = $this->userFolder->get($this->folder); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
|
$share1->setNode($node1) |
|
|
|
@ -1023,7 +1023,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* @medium |
|
|
|
|
*/ |
|
|
|
|
public function testUpdateShareExpireDate() { |
|
|
|
|
public function testUpdateShareExpireDate(): void { |
|
|
|
|
$node1 = $this->userFolder->get($this->folder); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
|
$share1->setNode($node1) |
|
|
|
@ -1096,7 +1096,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* @medium |
|
|
|
|
* @depends testCreateShareUserFile |
|
|
|
|
*/ |
|
|
|
|
public function testDeleteShare() { |
|
|
|
|
public function testDeleteShare(): void { |
|
|
|
|
$node1 = $this->userFolder->get($this->filename); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
|
$share1->setNode($node1) |
|
|
|
@ -1128,7 +1128,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* test unshare of a reshared file |
|
|
|
|
*/ |
|
|
|
|
public function testDeleteReshare() { |
|
|
|
|
public function testDeleteReshare(): void { |
|
|
|
|
$node1 = $this->userFolder->get($this->folder); |
|
|
|
|
$share1 = $this->shareManager->newShare(); |
|
|
|
|
$share1->setNode($node1) |
|
|
|
@ -1163,7 +1163,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* share a folder which contains a share mount point, should be forbidden |
|
|
|
|
*/ |
|
|
|
|
public function testShareFolderWithAMountPoint() { |
|
|
|
|
public function testShareFolderWithAMountPoint(): void { |
|
|
|
|
// user 1 shares a folder with user2 |
|
|
|
|
self::loginHelper(self::TEST_FILES_SHARING_API_USER1); |
|
|
|
|
|
|
|
|
@ -1230,7 +1230,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* Tests mounting a folder that is an external storage mount point. |
|
|
|
|
*/ |
|
|
|
|
public function testShareStorageMountPoint() { |
|
|
|
|
public function testShareStorageMountPoint(): void { |
|
|
|
|
$tempStorage = new \OC\Files\Storage\Temporary([]); |
|
|
|
|
$tempStorage->file_put_contents('test.txt', 'abcdef'); |
|
|
|
|
$tempStorage->getScanner()->scan(''); |
|
|
|
@ -1286,7 +1286,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* @dataProvider datesProvider |
|
|
|
|
* @group RoutingWeirdness |
|
|
|
|
*/ |
|
|
|
|
public function testPublicLinkExpireDate($date, $valid) { |
|
|
|
|
public function testPublicLinkExpireDate($date, $valid): void { |
|
|
|
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
@ -1318,7 +1318,7 @@ class ApiTest extends TestCase { |
|
|
|
|
/** |
|
|
|
|
* @group RoutingWeirdness |
|
|
|
|
*/ |
|
|
|
|
public function testCreatePublicLinkExpireDateValid() { |
|
|
|
|
public function testCreatePublicLinkExpireDateValid(): void { |
|
|
|
|
$config = \OC::$server->getConfig(); |
|
|
|
|
|
|
|
|
|
// enforce expire date, by default 7 days after the file was shared |
|
|
|
@ -1350,7 +1350,7 @@ class ApiTest extends TestCase { |
|
|
|
|
$config->setAppValue('core', 'shareapi_enforce_expire_date', 'no'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testCreatePublicLinkExpireDateInvalidFuture() { |
|
|
|
|
public function testCreatePublicLinkExpireDateInvalidFuture(): void { |
|
|
|
|
$config = \OC::$server->getConfig(); |
|
|
|
|
|
|
|
|
|
// enforce expire date, by default 7 days after the file was shared |
|
|
|
@ -1400,7 +1400,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* test for no invisible shares |
|
|
|
|
* See: https://github.com/owncloud/core/issues/22295 |
|
|
|
|
*/ |
|
|
|
|
public function testInvisibleSharesUser() { |
|
|
|
|
public function testInvisibleSharesUser(): void { |
|
|
|
|
// simulate a post request |
|
|
|
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
|
|
|
|
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); |
|
|
|
@ -1432,7 +1432,7 @@ class ApiTest extends TestCase { |
|
|
|
|
* test for no invisible shares |
|
|
|
|
* See: https://github.com/owncloud/core/issues/22295 |
|
|
|
|
*/ |
|
|
|
|
public function testInvisibleSharesGroup() { |
|
|
|
|
public function testInvisibleSharesGroup(): void { |
|
|
|
|
// simulate a post request |
|
|
|
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); |
|
|
|
|
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); |
|
|
|
|