Skip to content

Commit fa79fca

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

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed

tests/acceptance/bootstrap/WebDav.php

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ public function userMovesResourceWithTheFollowingHeadersUsingTheWebDavAPI(
572572
): void {
573573
$headers = [];
574574
foreach ($table->getColumnsHash() as $header) {
575-
$headers[$header["header"]] = $header["value"];
575+
$headers[$header["header"]] = $header["value"];
576576
}
577577
$response = $this->moveResource($user, $source, $destination, $headers);
578578
$this->setResponse($response);
@@ -2576,13 +2576,14 @@ public function theUserShouldNotBeAbleToDeleteEntry(string $user, string $entry,
25762576
/**
25772577
* @param string $user
25782578
* @param string $resource
2579+
* @param array|null $headers
25792580
*
25802581
* @return void
25812582
*/
2582-
public function deleteFile(string $user, string $resource): ResponseInterface {
2583+
public function deleteFile(string $user, string $resource, ?array $headers = []): ResponseInterface {
25832584
$user = $this->getActualUsername($user);
25842585
$this->pauseUploadDelete();
2585-
$response = $this->makeDavRequest($user, 'DELETE', $resource, []);
2586+
$response = $this->makeDavRequest($user, 'DELETE', $resource, $headers);
25862587
$this->lastUploadDeleteTime = \time();
25872588
return $response;
25882589
}
@@ -2601,6 +2602,29 @@ public function userDeletesFile(string $user, string $resource): void {
26012602
$this->pushToLastStatusCodesArrays();
26022603
}
26032604

2605+
/**
2606+
* @When user :user deletes file/folder :resource with the following headers using the WebDAV API
2607+
*
2608+
* @param string $user
2609+
* @param string $resource
2610+
* @param TableNode $table
2611+
*
2612+
* @return void
2613+
*/
2614+
public function userDeletesFileOrFolderWithTheFollowingHeadersUsingTheWebDAVAPI(
2615+
string $user,
2616+
string $resource,
2617+
TableNode $table,
2618+
): void {
2619+
$headers = [];
2620+
foreach ($table->getColumnsHash() as $header) {
2621+
$headers[$header["header"]] = $header["value"];
2622+
}
2623+
$response = $this->deleteFile($user, $resource, $headers);
2624+
$this->setResponse($response);
2625+
$this->pushToLastStatusCodesArrays();
2626+
}
2627+
26042628
/**
26052629
* @When user :user deletes file :filename from space :space using file-id :fileId
26062630
*

tests/acceptance/features/coreApiWebdavDelete/deleteFolder.feature

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,18 @@ Feature: delete folder
7979
| spaces | /..fo |
8080
| spaces | /fo.xyz |
8181
| spaces | /fo.exe |
82+
83+
@issue-10809
84+
Scenario Outline: delete a folder with Transfer-Encoding: chunked header
85+
Given using <dav-path-version> DAV path
86+
When user "Alice" deletes folder "PARENT" with the following headers using the WebDAV API
87+
| header | value |
88+
# NOTE: requires system curl version >= 8.12.0
89+
| Transfer-Encoding | chunked |
90+
Then the HTTP status code should be "204"
91+
And as "Alice" folder "PARENT" should not exist
92+
Examples:
93+
| dav-path-version |
94+
| old |
95+
| new |
96+
| spaces |

0 commit comments

Comments
 (0)