From 6e0fa568155a3e86692e83e55863aabdadbcd739 Mon Sep 17 00:00:00 2001 From: KarunAtreya Date: Tue, 10 Oct 2023 14:12:52 +0545 Subject: [PATCH] refactored removing setting response in given/then steps in spacetus context adressing reviews --- .../features/bootstrap/SpacesTUSContext.php | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/acceptance/features/bootstrap/SpacesTUSContext.php b/tests/acceptance/features/bootstrap/SpacesTUSContext.php index d8234f27cbf..6115d8d8820 100644 --- a/tests/acceptance/features/bootstrap/SpacesTUSContext.php +++ b/tests/acceptance/features/bootstrap/SpacesTUSContext.php @@ -57,8 +57,8 @@ public function before(BeforeScenarioScope $scope): void { * @throws GuzzleException */ public function userHasUploadedFileViaTusInSpace(string $user, string $source, string $destination, string $spaceName): void { - $this->userUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi($user, $source, $destination, $spaceName); - $this->featureContext->theHTTPStatusCodeShouldBe(200, "Expected response status code should be 200"); + $this->spacesContext->setSpaceIDByName($user, $spaceName); + $this->tusContext->userUploadsUsingTusAFileTo($user, $source, $destination); } /** @@ -102,8 +102,9 @@ public function userHasCreatedANewTusResourceForTheSpaceUsingTheWebdavApiWithThe string $content, TableNode $headers ): void { - $this->userCreatesANewTusResourceForTheSpaceUsingTheWebdavApiWithTheseHeaders($user, $spaceName, $content, $headers); - $this->featureContext->theHTTPStatusCodeShouldBe(201, "Expected response status code should be 201"); + $this->spacesContext->setSpaceIDByName($user, $spaceName); + $response = $this->tusContext->createNewTUSResourceWithHeaders($user, $headers, $content); + $this->featureContext->theHTTPStatusCodeShouldBe(201, "Expected response status code should be 201", $response); } /** @@ -152,7 +153,7 @@ public function userUploadsAFileWithContentToViaTusInsideOfTheSpaceUsingTheWebda } /** - * @When /^user "([^"]*)" has uploaded a file with content "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)"$/ + * @Given /^user "([^"]*)" has uploaded a file with content "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)"$/ * * @param string $user * @param string $content @@ -169,10 +170,6 @@ public function userHasUploadedAFileWithContentToViaTusInsideOfTheSpace( string $spaceName ): void { $this->userUploadsAFileWithContentToViaTusInsideOfTheSpaceUsingTheWebdavApi($user, $content, $resource, $spaceName); - $this->featureContext->theHTTPStatusCodeShouldBe( - 200, - "Expected response status code should be 200" - ); } /** @@ -224,7 +221,7 @@ public function userHasUploadedFileWithChecksumToTheLastCreatedTusLocationWithOf } /** - * @Given /^user "([^"]*)" uploads file with checksum "([^"]*)" to the last created TUS Location with offset "([^"]*)" and content "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/ + * @When /^user "([^"]*)" uploads file with checksum "([^"]*)" to the last created TUS Location with offset "([^"]*)" and content "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/ * * @param string $user * @param string $checksum @@ -243,7 +240,8 @@ public function userUploadsFileWithChecksumToTheLastCreatedTusLocationWithOffset string $spaceName ): void { $this->spacesContext->setSpaceIDByName($user, $spaceName); - $this->tusContext->userUploadsFileWithChecksum($user, $checksum, $offset, $content); + $response = $this->tusContext->sendsAChunkToTUSLocationWithOffsetAndData($user, $offset, $content, $checksum); + $this->featureContext->setResponse($response); } /**