add tests for file version with OCIS_DISABLE_VERSIONING config

This commit is contained in:
amrita
2024-09-26 16:58:06 +05:45
parent 3f71d37ad6
commit 8cc13a2dbe
4 changed files with 123 additions and 12 deletions

View File

@@ -36,6 +36,25 @@ require_once 'bootstrap.php';
*/
class FilesVersionsContext implements Context {
private FeatureContext $featureContext;
private SpacesContext $spacesContext;
/**
* This will run before EVERY scenario.
* It will set the properties for this object.
*
* @BeforeScenario
*
* @param BeforeScenarioScope $scope
*
* @return void
*/
public function before(BeforeScenarioScope $scope):void {
// Get the environment
$environment = $scope->getEnvironment();
// Get all the contexts you need in this context
$this->featureContext = BehatHelper::getContext($scope, $environment, 'FeatureContext');
$this->spacesContext = BehatHelper::getContext($scope, $environment, 'SpacesContext');
}
/**
* @When user :user tries to get versions of file :file from :fileOwner
@@ -547,19 +566,27 @@ class FilesVersionsContext implements Context {
}
/**
* This will run before EVERY scenario.
* It will set the properties for this object.
* @When user :user gets the number of versions of file :file from space :space
* @When user :user tries to get the number of versions of file :file from space :space
*
* @BeforeScenario
*
* @param BeforeScenarioScope $scope
* @param string $user
* @param string $file
* @param string $space
*
* @return void
*/
public function before(BeforeScenarioScope $scope):void {
// Get the environment
$environment = $scope->getEnvironment();
// Get all the contexts you need in this context
$this->featureContext = BehatHelper::getContext($scope, $environment, 'FeatureContext');
public function userGetsTheNumberOfVersionsOfFileFromSpace(string $user, string $file, string $space): void {
$fileId = $this->spacesContext->getFileId($user, $space, $file);
$this->featureContext->setResponse(
$this->featureContext->makeDavRequest(
$user,
"PROPFIND",
$fileId,
null,
null,
null,
"versions"
)
);
}
}