Merge pull request #11569 from Ashim-Stha/copyFolderWithHeader

[tests-only][full-ci] Add test for copying folder, moving folder and deleting folder with `Transfer-Encoding: chunked` header
This commit is contained in:
Sawjan Gurung authored and GitHub committed 2025-08-04 18:01:38 +05:45
commit dfcabbf17d
4 files changed
+106 -3

No files matched your search

+60 -3
View File
@@ -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
*
@@ -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 |
@@ -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-version> 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 |
@@ -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-version> 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 |