diff --git a/tests/acceptance/bootstrap/CollaborationContext.php b/tests/acceptance/bootstrap/CollaborationContext.php index 1010dbf404..c35a124b98 100644 --- a/tests/acceptance/bootstrap/CollaborationContext.php +++ b/tests/acceptance/bootstrap/CollaborationContext.php @@ -205,4 +205,27 @@ class CollaborationContext implements Context { ) ); } + + /** + * @When user :user tries to create a file :file inside deleted folder using wopi endpoint + * + * @param string $user + * @param string $file + * + * @return void + * @throws GuzzleException + */ + public function userTriesToCreateAFileInsideDeletedFolderUsingWopiEndpoint(string $user, string $file): void { + $parentContainerId = $this->featureContext->getStoredFileID(); + $this->featureContext->setResponse( + CollaborationHelper::createFile( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $user, + $this->featureContext->getPasswordForUser($user), + $parentContainerId, + $file + ) + ); + } } diff --git a/tests/acceptance/features/apiCollaboration/wopi.feature b/tests/acceptance/features/apiCollaboration/wopi.feature index 7cda11ce7e..91a9c41ee6 100644 --- a/tests/acceptance/features/apiCollaboration/wopi.feature +++ b/tests/acceptance/features/apiCollaboration/wopi.feature @@ -986,3 +986,29 @@ Feature: collaboration (wopi) } """ And as "Alice" file "publicFolder/simple.odt" should not exist + + + Scenario: user tries to create odt file inside deleted parent folder using wopi endpoint + Given user "Alice" has created folder "testFolder" + And user "Alice" has stored id of folder "testFolder" + And user "Alice" has deleted folder "testFolder" + When user "Alice" tries to create a file "simple.odt" inside deleted folder using wopi endpoint + Then the HTTP status code should be "404" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "const": "RESOURCE_NOT_FOUND" + }, + "message": { + "const": "the parent container is not accessible or does not exist" + } + } + } + """