tests: refactor send profind request to space function (#7835)
This commit is contained in:
@@ -3477,25 +3477,41 @@ class SpacesContext implements Context {
|
|||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
* @param ?string $resource
|
* @param ?string $resource
|
||||||
*
|
*
|
||||||
* @throws GuzzleException
|
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
|
*
|
||||||
|
* @throws JsonException
|
||||||
|
*
|
||||||
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function userSendsPropfindRequestToSpace(string $user, string $spaceName, ?string $resource = ""): void {
|
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);
|
$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'];
|
$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(
|
return WebDavHelper::propfind(
|
||||||
WebDavHelper::propfind(
|
$this->featureContext->getBaseUrl(),
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getActualUsername($user),
|
||||||
$this->featureContext->getActualUsername($user),
|
$this->featureContext->getPasswordForUser($user),
|
||||||
$this->featureContext->getPasswordForUser($user),
|
$resource,
|
||||||
$resource,
|
$properties,
|
||||||
$properties,
|
$this->featureContext->getStepLineRef(),
|
||||||
$this->featureContext->getStepLineRef(),
|
"0",
|
||||||
"0",
|
"files",
|
||||||
"files",
|
WebDavHelper::DAV_VERSION_SPACES
|
||||||
WebDavHelper::DAV_VERSION_SPACES
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -914,9 +914,9 @@ class WebDavLockingContext implements Context {
|
|||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function numberOfLockShouldBeReportedInProjectSpace(int $count, string $file, string $spaceName, string $user) {
|
public function numberOfLockShouldBeReportedInProjectSpace(int $count, string $file, string $spaceName, string $user) {
|
||||||
$this->spacesContext->userSendsPropfindRequestToSpace($user, $spaceName, $file);
|
$response = $this->spacesContext->sendPropfindRequestToSpace($user, $spaceName, $file);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(207, "");
|
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
|
||||||
$responseXml = $this->featureContext->getResponseXml();
|
$responseXml = $this->featureContext->getResponseXml($response);
|
||||||
$xmlPart = $responseXml->xpath("//d:response//d:lockdiscovery/d:activelock");
|
$xmlPart = $responseXml->xpath("//d:response//d:lockdiscovery/d:activelock");
|
||||||
if (\is_array($xmlPart)) {
|
if (\is_array($xmlPart)) {
|
||||||
$lockCount = \count($xmlPart);
|
$lockCount = \count($xmlPart);
|
||||||
|
|||||||
Reference in New Issue
Block a user