diff --git a/tests/acceptance/bootstrap/WebDav.php b/tests/acceptance/bootstrap/WebDav.php index 32dcf8d1467..e9587df8f80 100644 --- a/tests/acceptance/bootstrap/WebDav.php +++ b/tests/acceptance/bootstrap/WebDav.php @@ -507,10 +507,16 @@ trait WebDav { * @param string $user * @param string $source * @param string $destination + * @param array|null $headers * * @return ResponseInterface */ - public function moveResource(string $user, string $source, string $destination): ResponseInterface { + public function moveResource( + string $user, + string $source, + string $destination, + ?array $headers = [], + ): ResponseInterface { $user = $this->getActualUsername($user); $headers['Destination'] = $this->destinationHeaderValue( $user, @@ -546,6 +552,33 @@ trait WebDav { $this->pushToLastHttpStatusCodesArray(); } + /** + * @When user :user moves file/folder :source to :destination with the following headers using the WebDAV API + * + * @param string $user + * @param string $source + * @param string $destination + * @param TableNode $table + * + * @return void + * @throws JsonException + * @throws GuzzleException + */ + public function userMovesResourceWithTheFollowingHeadersUsingTheWebDavAPI( + string $user, + string $source, + string $destination, + TableNode $table, + ): void { + $headers = []; + foreach ($table->getColumnsHash() as $header) { + $headers[$header["header"]] = $header["value"]; + } + $response = $this->moveResource($user, $source, $destination, $headers); + $this->setResponse($response); + $this->pushToLastHttpStatusCodesArray(); + } + /** * @When user :user moves the following file using the WebDAV API * @@ -2543,13 +2576,14 @@ trait WebDav { /** * @param string $user * @param string $resource + * @param array|null $headers * * @return void */ - public function deleteFile(string $user, string $resource): ResponseInterface { + public function deleteFile(string $user, string $resource, ?array $headers = []): ResponseInterface { $user = $this->getActualUsername($user); $this->pauseUploadDelete(); - $response = $this->makeDavRequest($user, 'DELETE', $resource, []); + $response = $this->makeDavRequest($user, 'DELETE', $resource, $headers); $this->lastUploadDeleteTime = \time(); return $response; } @@ -2568,6 +2602,29 @@ trait WebDav { $this->pushToLastStatusCodesArrays(); } + /** + * @When user :user deletes file/folder :resource with the following headers using the WebDAV API + * + * @param string $user + * @param string $resource + * @param TableNode $table + * + * @return void + */ + public function userDeletesFileOrFolderWithTheFollowingHeadersUsingTheWebDAVAPI( + string $user, + string $resource, + TableNode $table, + ): void { + $headers = []; + foreach ($table->getColumnsHash() as $header) { + $headers[$header["header"]] = $header["value"]; + } + $response = $this->deleteFile($user, $resource, $headers); + $this->setResponse($response); + $this->pushToLastStatusCodesArrays(); + } + /** * @When user :user deletes file :filename from space :space using file-id :fileId * diff --git a/tests/acceptance/features/apiContract/copy.feature b/tests/acceptance/features/apiContract/copy.feature index a727d81021e..e6b2dacc9ca 100644 --- a/tests/acceptance/features/apiContract/copy.feature +++ b/tests/acceptance/features/apiContract/copy.feature @@ -25,3 +25,14 @@ Feature: Copy test | Access-Control-Allow-Origin | /^%base_url%$/ | | X-Request-Id | %request_id_pattern% | + @issue-10809 + Scenario: copy a folder with Transfer-Encoding: chunked header + Given user "Alice" has created a folder "folder1" in space "new-space" + And user "Alice" has created a folder "folder2" in space "new-space" + When user "Alice" copies folder "folder2" from space "new-space" to "folder1/folder2" inside space "new-space" with following headers using the WebDAV API + | header | value | + # NOTE: requires system curl version >= 8.12.0 + | Transfer-Encoding | chunked | + Then the HTTP status code should be "201" + And for user "Alice" folder "folder1" of the space "new-space" should contain these entries: + | folder2 | diff --git a/tests/acceptance/features/coreApiWebdavDelete/deleteFolder.feature b/tests/acceptance/features/coreApiWebdavDelete/deleteFolder.feature index 815025e0f82..b75eb4f1d7f 100644 --- a/tests/acceptance/features/coreApiWebdavDelete/deleteFolder.feature +++ b/tests/acceptance/features/coreApiWebdavDelete/deleteFolder.feature @@ -79,3 +79,18 @@ Feature: delete folder | spaces | /..fo | | spaces | /fo.xyz | | spaces | /fo.exe | + + @issue-10809 + Scenario Outline: delete a folder with Transfer-Encoding: chunked header + Given using DAV path + When user "Alice" deletes folder "PARENT" with the following headers using the WebDAV API + | header | value | + # NOTE: requires system curl version >= 8.12.0 + | Transfer-Encoding | chunked | + Then the HTTP status code should be "204" + And as "Alice" folder "PARENT" should not exist + Examples: + | dav-path-version | + | old | + | new | + | spaces | diff --git a/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature b/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature index ea73465e4cd..a29c9856d90 100644 --- a/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature +++ b/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature @@ -264,3 +264,23 @@ Feature: move (rename) folder | old | | new | | spaces | + + @issue-10809 + Scenario Outline: move a folder with Transfer-Encoding: chunked header + Given using DAV path + And user "Alice" has created folder "folder1" + And user "Alice" has created folder "folder2" + When user "Alice" moves folder "folder2" to "folder1/folder2" with the following headers using the WebDAV API + | header | value | + # NOTE: requires system curl version >= 8.12.0 + | Transfer-Encoding | chunked | + Then the HTTP status code should be "201" + And user "Alice" should not see the following elements + | folder2 | + And user "Alice" should see the following elements + | folder1/folder2 | + Examples: + | dav-path-version | + | old | + | new | + | spaces |