From 5c900e3ead22dd051f30a1c9edc1f90f51676fd3 Mon Sep 17 00:00:00 2001 From: KarunAtreya Date: Thu, 21 Sep 2023 16:04:54 +0545 Subject: [PATCH] addressed the reviews --- .../features/bootstrap/SettingsContext.php | 11 +++++++++-- tests/acceptance/features/bootstrap/TUSContext.php | 14 ++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/acceptance/features/bootstrap/SettingsContext.php b/tests/acceptance/features/bootstrap/SettingsContext.php index 336cefba160..f9b3d7ab6c5 100644 --- a/tests/acceptance/features/bootstrap/SettingsContext.php +++ b/tests/acceptance/features/bootstrap/SettingsContext.php @@ -390,7 +390,13 @@ public function sendRequestToSwitchSystemLanguage(string $user, string $language ], JSON_THROW_ON_ERROR ); - return $this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), $body, $this->featureContext->getStepLineRef()); + return $this->spacesContext->sendPostRequestToUrl( + $fullUrl, + $user, + $this->featureContext->getPasswordForUser($user), + $body, + $this->featureContext->getStepLineRef() + ); } /** @@ -405,10 +411,11 @@ public function sendRequestToSwitchSystemLanguage(string $user, string $language * @throws GuzzleException */ public function theUserHasSwitchedSystemLanguage(string $user, string $language): void { + $response = $this->sendRequestToSwitchSystemLanguage($user, $language); $this->featureContext->theHTTPStatusCodeShouldBe( 201, "Expected response status code should be 201", - $this->sendRequestToSwitchSystemLanguage($user, $language) + $response ); } } diff --git a/tests/acceptance/features/bootstrap/TUSContext.php b/tests/acceptance/features/bootstrap/TUSContext.php index 0f7639acf39..d890de01292 100644 --- a/tests/acceptance/features/bootstrap/TUSContext.php +++ b/tests/acceptance/features/bootstrap/TUSContext.php @@ -104,7 +104,7 @@ public function userCreateNewTUSResourceWithHeaders(string $user, TableNode $hea * @throws Exception * @throws GuzzleException */ - public function createNewTUSResource(string $user, TableNode $headers): void { + public function userHasCreatedNewTUSResourceWithHeaders(string $user, TableNode $headers): void { $rows = $headers->getRows(); $rows[] = ['Tus-Resumable', '1.0.0']; $response = $this->createNewTUSResourceWithHeaders($user, new TableNode($rows)); @@ -125,7 +125,7 @@ public function createNewTUSResource(string $user, TableNode $headers): void { public function sendsAChunkToTUSLocationWithOffsetAndData(string $user, string $offset, string $data, string $checksum = ''): ResponseInterface { $user = $this->featureContext->getActualUsername($user); $password = $this->featureContext->getUserPassword($user); - $response = HttpRequestHelper::sendRequest( + return HttpRequestHelper::sendRequest( $this->resourceLocation, $this->featureContext->getStepLineRef(), 'PATCH', @@ -139,24 +139,22 @@ public function sendsAChunkToTUSLocationWithOffsetAndData(string $user, string $ ], $data ); - return $response; } /** - * @When /^user "([^"]*)" sends a chunk to the last created TUS Location with offset "([^"]*)" and data "([^"]*)" using the WebDAV API$/ + * @When user :user sends a chunk to the last created TUS Location with offset :offset and data :data using the WebDAV API * * @param string $user * @param string $offset * @param string $data - * @param string $checksum * * @return void * * @throws GuzzleException * @throws JsonException */ - public function userSendsAChunkToTUSLocationWithOffsetAndData(string $user, string $offset, string $data, string $checksum = ''): void { - $response = $this->sendsAChunkToTUSLocationWithOffsetAndData($user, $offset, $data, $checksum); + public function userSendsAChunkToTUSLocationWithOffsetAndData(string $user, string $offset, string $data): void { + $response = $this->sendsAChunkToTUSLocationWithOffsetAndData($user, $offset, $data); $this->featureContext->setResponse($response); WebDavHelper::$SPACE_ID_FROM_OCIS = ''; } @@ -511,7 +509,7 @@ public function userHasUploadedChunkFileWithChecksum(string $user, string $offse * @throws Exception */ public function userOverwritesFileWithChecksum(string $user, string $offset, string $data, string $checksum, TableNode $headers): void { - $this->createNewTUSResource($user, $headers); + $this->userHasCreatedNewTUSResourceWithHeaders($user, $headers); $response = $this->sendsAChunkToTUSLocationWithOffsetAndData($user, $offset, $data, $checksum); $this->featureContext->setResponse($response); }