test: merge similar steps

This commit is contained in:
Saw-jan
2024-11-27 14:54:18 +05:45
parent 5bbe356d36
commit bc63c2cbd7
5 changed files with 41 additions and 58 deletions
+19 -36
View File
@@ -1858,7 +1858,7 @@ trait Sharing {
}
/**
* @Then the information about the last share for user :user should include
* @Then as user :user the last share should include the following properties:
*
* @param string $user
* @param TableNode $table
@@ -1868,8 +1868,24 @@ trait Sharing {
*/
public function userGetsTheLastShareSharedWithHimUsingTheSharingApi(string $user, TableNode $table):void {
$user = $this->getActualUsername($user);
$shareId = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId();
$response = $this->getShareData($user, $shareId);
$this->verifyTableNodeRows($table, [], $this->shareResponseFields);
$share_id = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId();
$response = $this->getShareData($user, $share_id);
$this->theHTTPStatusCodeShouldBe(
200,
"Error getting info of last share for user $user",
$response
);
$this->ocsContext->assertOCSResponseIndicatesSuccess(
__METHOD__ .
' Error getting info of last share for user $user\n' .
$this->ocsContext->getOCSResponseStatusMessage(
$response
) . '"',
$response
);
$this->checkTheFields($user, $table, $response);
}
@@ -2031,39 +2047,6 @@ trait Sharing {
$this->setResponse($this->getAllShares($user, "?path=$path&subfiles=true"));
}
/**
* @Then /^the response when user "([^"]*)" gets the info of the last share should include$/
*
* @param string $user
* @param TableNode|null $body
*
* @return void
* @throws Exception
*/
public function theResponseWhenUserGetsInfoOfLastShareShouldInclude(
string $user,
?TableNode $body
):void {
$user = $this->getActualUsername($user);
$this->verifyTableNodeRows($body, [], $this->shareResponseFields);
$share_id = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId();
$response = $this->getShareData($user, $share_id);
$this->theHTTPStatusCodeShouldBe(
200,
"Error getting info of last share for user $user",
$response
);
$this->ocsContext->assertOCSResponseIndicatesSuccess(
__METHOD__ .
' Error getting info of last share for user $user\n' .
$this->ocsContext->getOCSResponseStatusMessage(
$response
) . '"',
$response
);
$this->checkTheFields($user, $body, $response);
}
/**
* @Then /^the response when user "([^"]*)" gets the info of the last public link share should include$/
*
+1 -1
View File
@@ -100,7 +100,7 @@ trait WebDav {
* @return void
*/
public function setFilePreviewContent(string $user, string $previewContent): void {
$filePreviews[$user] = $previewContent;
$this->filePreviews[$user] = $previewContent;
}
/**