removing usage of a stepdefination inside another stepdefination in WedDav.php (#9205)

This commit is contained in:
nirajacharya2
2024-05-30 17:07:09 +05:45
committed by GitHub
parent a5c6ea6fda
commit c48f43531d
6 changed files with 486 additions and 153 deletions

View File

@@ -358,8 +358,8 @@ class ChecksumContext implements Context {
* @throws Exception
*/
public function theHeaderChecksumWhenUserDownloadsFileUsingTheWebdavApiShouldMatch(string $user, string $fileName, string $expectedChecksum):void {
$this->featureContext->userDownloadsFileUsingTheAPI($user, $fileName);
$headerChecksums = $this->featureContext->getResponse()->getHeader('OC-Checksum');
$response = $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName);
$headerChecksums = $response->getHeader('OC-Checksum');
Assert::assertIsArray(
$headerChecksums,

View File

@@ -349,7 +349,7 @@ class FilesVersionsContext implements Context {
$this->getFileVersionMetadata($actualUsername, $filename)
);
foreach ($requiredVersionMetadata as $versionMetadata) {
$this->featureContext->theAuthorOfEditedVersionFile(
$this->featureContext->checkAuthorOfAVersionOfFile(
$versionMetadata['index'],
$versionMetadata['author']
);

View File

@@ -1567,10 +1567,10 @@ class PublicWebDavContext implements Context {
/**
* @When the public uploads file :fileName to the last public link shared folder with password :password with mtime :mtime using the :davVersion public WebDAV API
*
* @param String $fileName
* @param String $password
* @param String $mtime
* @param String $davVersion
* @param string $fileName
* @param string $password
* @param string $mtime
* @param string $davVersion
*
* @return void
* @throws Exception

View File

@@ -3143,7 +3143,9 @@ class SpacesContext implements Context {
string $spaceName
): void {
$this->setSpaceIDByName($user, $spaceName);
$this->featureContext->userUploadsAFileWithChecksumAndContentTo($user, $checksum, $content, $destination);
$this->featureContext->setResponse(
$this->featureContext->uploadFileWithChecksumAndContent($user, $checksum, $content, $destination)
);
}
/**
@@ -3575,7 +3577,7 @@ class SpacesContext implements Context {
*/
public function userHasStoredIdOfPathOfTheSpace(string $user, string $path, string $spaceName): void {
$this->setSpaceIDByName($user, $spaceName);
$this->featureContext->userStoresFileIdForPath($user, $path);
$this->featureContext->setStoredFileID($this->featureContext->getFileIdForPath($user, $path));
}
/**
@@ -3592,7 +3594,15 @@ class SpacesContext implements Context {
*/
public function userFolderOfTheSpaceShouldHaveThePreviouslyStoredId(string $user, string $fileOrFolder, string $path, string $spaceName): void {
$this->setSpaceIDByName($user, $spaceName);
$this->featureContext->userFileShouldHaveStoredId($user, $fileOrFolder, $path);
$user = $this->featureContext->getActualUsername($user);
$currentFileID = $this->featureContext->getFileIdForPath($user, $path);
$storedFileID = $this->featureContext->getStoredFileID();
Assert::assertEquals(
$currentFileID,
$storedFileID,
__METHOD__
. " User '$user' $fileOrFolder '$path' does not have the previously stored id '$storedFileID', but has '$currentFileID'."
);
}
/**

View File

@@ -14,6 +14,7 @@ use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use GuzzleHttp\Exception\GuzzleException;
use Behat\Gherkin\Node\TableNode;
use PHPUnit\Framework\Assert;
use TestHelpers\WebDavHelper;
require_once 'bootstrap.php';
@@ -394,6 +395,17 @@ class SpacesTUSContext implements Context {
string $mtime
): void {
$this->spacesContext->setSpaceIDByName($user, $spaceName);
$this->featureContext->theMtimeOfTheFileShouldBe($user, $resource, $mtime);
$mtime = new DateTime($mtime);
Assert::assertEquals(
$mtime->format('U'),
WebDavHelper::getMtimeOfResource(
$this->featureContext->getActualUsername($user),
$this->featureContext->getPasswordForUser($user),
$this->featureContext->getBaseUrl(),
$resource,
$this->featureContext->getStepLineRef(),
$this->featureContext->getDavPathVersion()
)
);
}
}

File diff suppressed because it is too large Load Diff