Skip to content

Commit eb273c7

Browse files
committed
test: add test for moving folder with Transfer-Encoding: chunked header
Signed-off-by: Ashim-Stha <ashimshrestha2384@gmail.com>
1 parent a63e759 commit eb273c7

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

tests/acceptance/bootstrap/WebDav.php

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,16 @@ public function userHasMovedFile(
507507
* @param string $user
508508
* @param string $source
509509
* @param string $destination
510+
* @param array|null $headers
510511
*
511512
* @return ResponseInterface
512513
*/
513-
public function moveResource(string $user, string $source, string $destination): ResponseInterface {
514+
public function moveResource(
515+
string $user,
516+
string $source,
517+
string $destination,
518+
?array $headers = [],
519+
): ResponseInterface {
514520
$user = $this->getActualUsername($user);
515521
$headers['Destination'] = $this->destinationHeaderValue(
516522
$user,
@@ -546,6 +552,33 @@ public function userMovesFileOrFolderUsingTheWebDavAPI(
546552
$this->pushToLastHttpStatusCodesArray();
547553
}
548554

555+
/**
556+
* @When user :user moves file/folder :source to :destination with the following headers using the WebDAV API
557+
*
558+
* @param string $user
559+
* @param string $source
560+
* @param string $destination
561+
* @param TableNode $table
562+
*
563+
* @return void
564+
* @throws JsonException
565+
* @throws GuzzleException
566+
*/
567+
public function userMovesResourceWithTheFollowingHeadersUsingTheWebDavAPI(
568+
string $user,
569+
string $source,
570+
string $destination,
571+
TableNode $table,
572+
): void {
573+
$headers = [];
574+
foreach ($table->getColumnsHash() as $header) {
575+
$headers[$header["header"]] = $header["value"];
576+
}
577+
$response = $this->moveResource($user, $source, $destination, $headers);
578+
$this->setResponse($response);
579+
$this->pushToLastHttpStatusCodesArray();
580+
}
581+
549582
/**
550583
* @When user :user moves the following file using the WebDAV API
551584
*

tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,23 @@ Feature: move (rename) folder
264264
| old |
265265
| new |
266266
| spaces |
267+
268+
@issue-10809
269+
Scenario Outline: move a folder with Transfer-Encoding: chunked header
270+
Given using <dav-path-version> DAV path
271+
And user "Alice" has created folder "folder1"
272+
And user "Alice" has created folder "folder2"
273+
When user "Alice" moves folder "folder2" to "folder1/folder2" with the following headers using the WebDAV API
274+
| header | value |
275+
# NOTE: requires system curl version >= 8.12.0
276+
| Transfer-Encoding | chunked |
277+
Then the HTTP status code should be "201"
278+
And user "Alice" should not see the following elements
279+
| folder2 |
280+
And user "Alice" should see the following elements
281+
| folder1/folder2 |
282+
Examples:
283+
| dav-path-version |
284+
| old |
285+
| new |
286+
| spaces |

0 commit comments

Comments
 (0)