Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 47 additions & 19 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,47 @@ public function userOnUploadsAFileTo($user, $server, $source, $destination) {
$this->usingServer($previousServer);
}

/**
* Upload file as a user with different headers
*
* @param string $user
* @param string $source
* @param string $destination
* @param array $headers
* @param int $noOfChunks Only use for chunked upload when $this->chunkingToUse is not null
*
* @return void
*/
public function uploadFileWithHeaders(
$user,
$source,
$destination,
$headers=[],
$noOfChunks = 0
) {
$chunkingVersion = $this->chunkingToUse;
if ($noOfChunks <= 0) {
$chunkingVersion = null;
}
try {
$this->responseXml = [];
$this->response = UploadHelper::upload(
$this->getBaseUrl(),
$this->getActualUsername($user),
$this->getUserPassword($user),
$source,
$destination,
$headers,
($this->usingOldDavPath) ? 1 : 2,
$chunkingVersion,
$noOfChunks
);
} catch (BadResponseException $e) {
// 4xx and 5xx responses cause an exception
$this->response = $e->getResponse();
}
}

/**
* @When /^user "([^"]*)" uploads file "([^"]*)" to "([^"]*)" in (\d+) chunks (?:with (new|old|v1|v2) chunking and)?\s?using the WebDAV API$/
* @When user :user uploads file :source to :destination with chunks using the WebDAV API
Expand Down Expand Up @@ -1748,25 +1789,12 @@ public function userUploadsAFileToWithChunks(
if ($async === true) {
$headers = ['OC-LazyOps' => 'true'];
}
try {
$this->responseXml = [];
$this->pauseUpload();
$this->response = UploadHelper::upload(
$this->getBaseUrl(),
$this->getActualUsername($user),
$this->getUserPassword($user),
$this->acceptanceTestsDirLocation() . $source,
$destination,
$headers,
($this->usingOldDavPath) ? 1 : 2,
$this->chunkingToUse,
$noOfChunks
);
$this->lastUploadTime = \time();
} catch (BadResponseException $e) {
// 4xx and 5xx responses cause an exception
$this->response = $e->getResponse();
}
$this->uploadFileWithHeaders(
$user,
$this->acceptanceTestsDirLocation() . $source,
$destination,
$headers
);
}

/**
Expand Down