refactored acceptance test code to store response data related to public shares on single store (#6930)
This commit is contained in:
@@ -366,20 +366,6 @@ class SpacesContext implements Context {
|
||||
return \str_replace('"', '\"', $fileData["Etag"][0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* using method from core to set share data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastShareData(): void {
|
||||
// set last response as PublicShareData
|
||||
$this->featureContext->setLastPublicShareData($this->featureContext->getResponseXml(null, __METHOD__));
|
||||
// set last shareId if ShareData exists
|
||||
if (isset($this->featureContext->getLastPublicShareData()->data)) {
|
||||
$this->featureContext->setLastPublicLinkShareId((string) $this->featureContext->getLastPublicShareData()->data[0]->id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @BeforeScenario
|
||||
*
|
||||
@@ -1927,7 +1913,8 @@ class SpacesContext implements Context {
|
||||
$body
|
||||
)
|
||||
);
|
||||
$this->setLastShareData();
|
||||
$response = $this->featureContext->getResponseXml(null, __METHOD__);
|
||||
$this->featureContext->addToCreatedPublicShares($response->data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1980,7 +1967,7 @@ class SpacesContext implements Context {
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function updateSharedResource(string $user, array $rows):ResponseInterface {
|
||||
$shareId = $this->featureContext->getLastPublicLinkShareId();
|
||||
$shareId = (string) $this->featureContext->getLastCreatedPublicShare()->id;
|
||||
$fullUrl = $this->baseUrl . $this->ocsApiUrl . '/' . $shareId;
|
||||
return HttpRequestHelper::sendRequest(
|
||||
$fullUrl,
|
||||
@@ -2050,7 +2037,8 @@ class SpacesContext implements Context {
|
||||
)
|
||||
);
|
||||
|
||||
$this->setLastShareData();
|
||||
$response = $this->featureContext->getResponseXml(null, __METHOD__);
|
||||
$this->featureContext->addToCreatedPublicShares($response->data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2882,7 +2870,8 @@ class SpacesContext implements Context {
|
||||
)
|
||||
);
|
||||
|
||||
$this->setLastShareData();
|
||||
$response = $this->featureContext->getResponseXml(null, __METHOD__);
|
||||
$this->featureContext->addToCreatedPublicShares($response->data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2907,7 +2896,6 @@ class SpacesContext implements Context {
|
||||
$expectedHTTPStatus,
|
||||
"Expected response status code should be $expectedHTTPStatus"
|
||||
);
|
||||
$this->featureContext->setLastPublicLinkShareId((string) $this->featureContext->getLastPublicShareData()->data[0]->id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2952,7 +2940,7 @@ class SpacesContext implements Context {
|
||||
if ($should) {
|
||||
Assert::assertNotEmpty($responseArray, __METHOD__ . ' Response should contain a link, but it is empty');
|
||||
foreach ($responseArray as $element) {
|
||||
$expectedLinkId = $this->featureContext->getLastPublicLinkShareId();
|
||||
$expectedLinkId = (string) $this->featureContext->getLastCreatedPublicShare()->id;
|
||||
Assert::assertEquals($element["id"], $expectedLinkId, "link IDs are different");
|
||||
}
|
||||
} else {
|
||||
@@ -3231,7 +3219,7 @@ class SpacesContext implements Context {
|
||||
* @throws GuzzleException|JsonException
|
||||
*/
|
||||
public function publicDownloadsTheFolderFromTheLastCreatedPublicLink(string $resource) {
|
||||
$token = $this->featureContext->getLastPublicShareToken();
|
||||
$token = $this->featureContext->getLastCreatedPublicShareToken();
|
||||
$response = $this->featureContext->listFolderAndReturnResponseXml(
|
||||
$token,
|
||||
$resource,
|
||||
|
||||
Reference in New Issue
Block a user