Skip to content

Commit 66d09cc

Browse files
author
Julien Veyssier
committed
test disabled public upload with file AND folder share creation
Signed-off-by: Julien Veyssier <[email protected]>
1 parent e251e0c commit 66d09cc

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

tests/lib/Share20/ManagerTest.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1915,13 +1915,32 @@ public function testLinkCreateChecksNoLinkSharesAllowed() {
19151915
}
19161916

19171917

1918-
public function testLinkCreateChecksNoPublicUpload() {
1918+
public function testFileLinkCreateChecksNoPublicUpload() {
1919+
$share = $this->manager->newShare();
1920+
1921+
$share->setPermissions(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
1922+
$share->setNodeType('file');
1923+
1924+
$this->config
1925+
->method('getAppValue')
1926+
->willReturnMap([
1927+
['core', 'shareapi_allow_links', 'yes', 'yes'],
1928+
['core', 'shareapi_allow_public_upload', 'yes', 'no']
1929+
]);
1930+
1931+
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
1932+
// dummy assertion, test fails if previous method call throws an exception
1933+
$this->assertTrue(true);
1934+
}
1935+
1936+
public function testFolderLinkCreateChecksNoPublicUpload() {
19191937
$this->expectException(\Exception::class);
19201938
$this->expectExceptionMessage('Public upload is not allowed');
19211939

19221940
$share = $this->manager->newShare();
19231941

19241942
$share->setPermissions(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
1943+
$share->setNodeType('folder');
19251944

19261945
$this->config
19271946
->method('getAppValue')

0 commit comments

Comments
 (0)