From cd7b15b250315fead42853b797876fe56270cb17 Mon Sep 17 00:00:00 2001 From: isha Date: Wed, 15 May 2024 16:45:22 +0545 Subject: [PATCH] [tests-only][full-ci] removing the usage of a stepdef inside another stepdef in ShareesContext.php (#9173) * removing the usage of a stepdefination inside another stepdefination in ShareesContext * use setResponse in step def --- .../features/bootstrap/ShareesContext.php | 55 ++++++++++++------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/tests/acceptance/features/bootstrap/ShareesContext.php b/tests/acceptance/features/bootstrap/ShareesContext.php index ef16827826..ee8f536ef3 100644 --- a/tests/acceptance/features/bootstrap/ShareesContext.php +++ b/tests/acceptance/features/bootstrap/ShareesContext.php @@ -45,9 +45,11 @@ class ShareesContext implements Context { * @return void */ public function theUserGetsTheShareesWithParameters(TableNode $body):void { - $this->userGetsTheShareesWithParameters( - $this->featureContext->getCurrentUser(), - $body + $this->featureContext->setResponse( + $this->getShareesWithParameters( + $this->featureContext->getCurrentUser(), + $body + ) ); } @@ -58,26 +60,14 @@ class ShareesContext implements Context { * @param TableNode $body * * @return void - * @throws Exception */ public function userGetsTheShareesWithParameters(string $user, TableNode $body):void { - $user = $this->featureContext->getActualUsername($user); - $url = '/apps/files_sharing/api/v1/sharees'; - $this->featureContext->verifyTableNodeColumnsCount($body, 2); - $parameters = []; - foreach ($body->getRowsHash() as $key => $value) { - $parameters[] = "$key=$value"; - } - if (!empty($parameters)) { - $url .= '?' . \implode('&', $parameters); - } - - $response = $this->ocsContext->sendRequestToOcsEndpoint( - $user, - 'GET', - $url + $this->featureContext->setResponse( + $this->getShareesWithParameters( + $user, + $body + ) ); - $this->featureContext->setResponse($response); } /** @@ -202,6 +192,31 @@ class ShareesContext implements Context { return $sharees; } + /** + * @param string $user + * @param TableNode $body + * + * @return ResponseInterface + */ + public function getShareesWithParameters(string $user, TableNode $body): ResponseInterface { + $user = $this->featureContext->getActualUsername($user); + $url = '/apps/files_sharing/api/v1/sharees'; + $this->featureContext->verifyTableNodeColumnsCount($body, 2); + $parameters = []; + foreach ($body->getRowsHash() as $key => $value) { + $parameters[] = "$key=$value"; + } + if (!empty($parameters)) { + $url .= '?' . \implode('&', $parameters); + } + + return $this->ocsContext->sendRequestToOcsEndpoint( + $user, + 'GET', + $url + ); + } + /** * This will run before EVERY scenario. * It will set the properties for this object.