From eb273c742b328833489f7976cf5b122b4e9d3cd2 Mon Sep 17 00:00:00 2001 From: Ashim-Stha Date: Wed, 30 Jul 2025 12:04:26 +0545 Subject: [PATCH] test: add test for moving folder with Transfer-Encoding: chunked header Signed-off-by: Ashim-Stha --- tests/acceptance/bootstrap/WebDav.php | 35 ++++++++++++++++++- .../coreApiWebdavMove1/moveFolder.feature | 20 +++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/bootstrap/WebDav.php b/tests/acceptance/bootstrap/WebDav.php index 32dcf8d1467..2baf9064698 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 * 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 |