Skip to content

Commit

Permalink
use the file from ocis
Browse files Browse the repository at this point in the history
  • Loading branch information
SwikritiT committed Aug 26, 2022
1 parent 75667e6 commit 1a7bbf8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/acceptance/features/bootstrap/TusContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function before(BeforeScenarioScope $scope): void {
* @throws GuzzleException
*/
public function uploadFileViaTus(string $user, string $resource, string $spaceName): void {
userUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi($user, $resource, $spaceName);
$this->userUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi($user, $resource, $spaceName);
$this->featureContext->theHTTPStatusCodeShouldBe(204, "Expected response status code should be 204");
}

Expand Down Expand Up @@ -129,7 +129,7 @@ public function createTusResource(string $user, string $resource, string $spaceN
$headers = [
"Tus-Resumable" => "1.0.0",
"Upload-Metadata" => $tusEndpoint . ',' . $fileName,
"Upload-Length" => filesize($this->featureContext->acceptanceTestsDirLocation() . 'filesForUpload/' . $resource)
"Upload-Length" => filesize($this->acceptanceTestsDirLocation() . $resource)
];
$this->featureContext->setResponse(
HttpRequestHelper::post(
Expand All @@ -143,14 +143,23 @@ public function createTusResource(string $user, string $resource, string $spaceN
);
}

public function uploadResourceThroughTUS(string $user, string $resource) {
/**
* send PATCH request to upload resource through TUS
*
* @param string $user
* @param string $resource
*
* @return void
* @throws Exception|GuzzleException
*/
public function uploadResourceThroughTUS(string $user, string $resource): void {
$resourceLocation = $this->featureContext->getResponse()->getHeader('Location');
if (\sizeof($resourceLocation) > 0) {
$resourceLocation = $resourceLocation[0];
} else {
throw new \Exception(__METHOD__ . " Location header could not be found");
}
$file = \fopen($this->featureContext->acceptanceTestsDirLocation() . 'filesForUpload/' . $resource, 'r');
$file = \fopen($this->acceptanceTestsDirLocation() . $resource, 'r');

$this->featureContext->setResponse(
HttpRequestHelper::sendRequest(
Expand Down

0 comments on commit 1a7bbf8

Please sign in to comment.