mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-07-19 20:14:17 -04:00
[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
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user