mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 03:09:33 -06:00
tests: refactor send profind request to space function (#7835)
This commit is contained in:
committed by
GitHub
parent
4d14e048d9
commit
0d9f676901
@@ -3477,25 +3477,41 @@ class SpacesContext implements Context {
|
||||
* @param string $spaceName
|
||||
* @param ?string $resource
|
||||
*
|
||||
* @throws GuzzleException
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws JsonException
|
||||
*
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function userSendsPropfindRequestToSpace(string $user, string $spaceName, ?string $resource = ""): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendPropfindRequestToSpace($user, $spaceName, $resource)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
* @param string|null $resource
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function sendPropfindRequestToSpace(string $user, string $spaceName, ?string $resource = ""): ResponseInterface {
|
||||
$this->setSpaceIDByName($user, $spaceName);
|
||||
$properties = ['oc:permissions','oc:file-parent','oc:fileid','oc:share-types','oc:privatelink','d:resourcetype','oc:size','oc:name','d:getcontenttype','oc:tags','d:lockdiscovery','d:activelock'];
|
||||
$this->featureContext->setResponse(
|
||||
WebDavHelper::propfind(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$resource,
|
||||
$properties,
|
||||
$this->featureContext->getStepLineRef(),
|
||||
"0",
|
||||
"files",
|
||||
WebDavHelper::DAV_VERSION_SPACES
|
||||
)
|
||||
return WebDavHelper::propfind(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$resource,
|
||||
$properties,
|
||||
$this->featureContext->getStepLineRef(),
|
||||
"0",
|
||||
"files",
|
||||
WebDavHelper::DAV_VERSION_SPACES
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -914,9 +914,9 @@ class WebDavLockingContext implements Context {
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function numberOfLockShouldBeReportedInProjectSpace(int $count, string $file, string $spaceName, string $user) {
|
||||
$this->spacesContext->userSendsPropfindRequestToSpace($user, $spaceName, $file);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(207, "");
|
||||
$responseXml = $this->featureContext->getResponseXml();
|
||||
$response = $this->spacesContext->sendPropfindRequestToSpace($user, $spaceName, $file);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
||||
$responseXml = $this->featureContext->getResponseXml($response);
|
||||
$xmlPart = $responseXml->xpath("//d:response//d:lockdiscovery/d:activelock");
|
||||
if (\is_array($xmlPart)) {
|
||||
$lockCount = \count($xmlPart);
|
||||
|
||||
Reference in New Issue
Block a user