[tests-only][full-ci] removing the setresponse in given/then step in FileVersionsContext (#7111)
* migrating set response from helper function to when step in preview feature * separate single when/then steps by converting to helper function * use of httpstatuscode check function in given step and rebased * change function name * remove use of setresponse in then step * set the returned response
This commit is contained in:
@@ -455,9 +455,9 @@ trait WebDav {
|
||||
* @param string|null $width
|
||||
* @param string|null $height
|
||||
*
|
||||
* @return void
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function downloadPreviews(string $user, ?string $path, ?string $doDavRequestAsUser, ?string $width, ?string $height):void {
|
||||
public function downloadPreviews(string $user, ?string $path, ?string $doDavRequestAsUser, ?string $width, ?string $height):ResponseInterface {
|
||||
$user = $this->getActualUsername($user);
|
||||
$doDavRequestAsUser = $this->getActualUsername($doDavRequestAsUser);
|
||||
$urlParameter = [
|
||||
@@ -466,7 +466,7 @@ trait WebDav {
|
||||
'forceIcon' => '0',
|
||||
'preview' => '1'
|
||||
];
|
||||
$this->response = $this->makeDavRequest(
|
||||
return $this->makeDavRequest(
|
||||
$user,
|
||||
"GET",
|
||||
$path,
|
||||
@@ -1053,14 +1053,17 @@ trait WebDav {
|
||||
/**
|
||||
* @param string $expectedContent
|
||||
* @param string $extraErrorText
|
||||
* @param ResponseInterface|null $response
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkDownloadedContentMatches(
|
||||
string $expectedContent,
|
||||
string $extraErrorText = ""
|
||||
string $extraErrorText = "",
|
||||
?ResponseInterface $response = null
|
||||
):void {
|
||||
$actualContent = (string) $this->response->getBody();
|
||||
$response = $response ?? $this->response;
|
||||
$actualContent = (string) $response->getBody();
|
||||
// For this test we really care about the content.
|
||||
// A separate "Then" step can specifically check the HTTP status.
|
||||
// But if the content is wrong (e.g. empty) then it is useful to
|
||||
@@ -4637,13 +4640,14 @@ trait WebDav {
|
||||
* @return void
|
||||
*/
|
||||
public function downloadPreviewOfFiles(string $user, string $path, string $width, string $height):void {
|
||||
$this->downloadPreviews(
|
||||
$response = $this->downloadPreviews(
|
||||
$user,
|
||||
$path,
|
||||
null,
|
||||
$width,
|
||||
$height
|
||||
);
|
||||
$this->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4658,13 +4662,14 @@ trait WebDav {
|
||||
* @return void
|
||||
*/
|
||||
public function downloadPreviewOfOtherUser(string $user1, string $path, string $doDavRequestAsUser, string $width, string $height):void {
|
||||
$this->downloadPreviews(
|
||||
$response = $this->downloadPreviews(
|
||||
$user1,
|
||||
$path,
|
||||
$doDavRequestAsUser,
|
||||
$width,
|
||||
$height
|
||||
);
|
||||
$this->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user