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.