From e0201c82d4b2445895603a8f84273a70fa336a12 Mon Sep 17 00:00:00 2001 From: amrita Date: Mon, 5 Sep 2022 16:00:16 +0545 Subject: [PATCH] Reuse core code --- .../features/apiSpaces/moveSpaces.feature | 4 +- .../features/bootstrap/SpacesContext.php | 39 ++++++++++++++++--- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/tests/acceptance/features/apiSpaces/moveSpaces.feature b/tests/acceptance/features/apiSpaces/moveSpaces.feature index 199a2f15a..dc7297f6e 100644 --- a/tests/acceptance/features/apiSpaces/moveSpaces.feature +++ b/tests/acceptance/features/apiSpaces/moveSpaces.feature @@ -262,7 +262,7 @@ Feature: move (rename) file And user "Brian" folder "/folderB/ONE" of the space "Shares Jail" should have the previously stored id - Scenario: Moving a file out of a shared folder as the sharer + Scenario: Moving a file out of a shared folder as a sharer Given user "Brian" has created folder "/testshare" And user "Brian" has uploaded file with content "test data" to "/testshare/testfile.txt" And user "Brian" has created a share with settings @@ -280,7 +280,7 @@ Feature: move (rename) file | /testshare/testfile.txt | - Scenario: Moving a folder out of a shared folder as the sharer + Scenario: Moving a folder out of a shared folder as a sharer Given user "Brian" has created the following folders | path | | /testshare | diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 174df5199..9ae2458e4 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -90,11 +90,6 @@ class SpacesContext implements Context { */ private string $davSpacesUrl = '/remote.php/dav/spaces/'; - /** - * @var string - */ - private string $storedFileID; - /** * @var array map with user as key, spaces and file etags as value * @example @@ -3230,4 +3225,38 @@ class SpacesContext implements Context { $this->setSpaceIDByName($user, $spaceName); $this->favoritesContext->userFavoritesElement($user, $path); } + + /** + * @Given /^user "([^"]*)" has stored id of (file|folder) "([^"]*)" of the space "([^"]*)"$/ + * + * @param string $user + * @param string $fileOrFolder + * @param string $path + * @param string $spaceName + * + * @return void + * + * @throws GuzzleException + */ + public function userHasStoredIdOfPathOfTheSpace(string $user, string $fileOrFolder, string $path, string $spaceName): void { + $this->setSpaceIDByName($user, $spaceName); + $this->featureContext->userStoresFileIdForPath($user, $fileOrFolder, $path); + } + + /** + * @Then /^user "([^"]*)" (folder|file) "([^"]*)" of the space "([^"]*)" should have the previously stored id$/ + * + * @param string|null $user + * @param string $fileOrFolder + * @param string $path + * @param string $spaceName + * + * @return void + * + * @throws GuzzleException + */ + public function userFolderOfTheSpaceShouldHaveThePreviouslyStoredId(string $user, string $fileOrFolder, string $path, string $spaceName): void { + $this->setSpaceIDByName($user, $spaceName); + $this->featureContext->userFileShouldHaveStoredId($user, $fileOrFolder, $path); + } }