refactor given when then steps in fileversions context (#7269)
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,10 +455,9 @@ trait WebDav {
|
||||
* @param string|null $width
|
||||
* @param string|null $height
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
* @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 = [
|
||||
@@ -467,14 +466,14 @@ trait WebDav {
|
||||
'forceIcon' => '0',
|
||||
'preview' => '1'
|
||||
];
|
||||
$this->response = $this->makeDavRequest(
|
||||
return $this->makeDavRequest(
|
||||
$user,
|
||||
"GET",
|
||||
$path,
|
||||
[],
|
||||
null,
|
||||
"files",
|
||||
null,
|
||||
'2',
|
||||
false,
|
||||
null,
|
||||
$urlParameter,
|
||||
@@ -1054,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
|
||||
@@ -4639,13 +4641,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4660,13 +4663,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