2022-08-23 17:05:12 +05:45
<? php
declare ( strict_types = 1 );
2022-08-23 09:26:30 +05:45
2022-08-23 17:05:12 +05:45
/**
* ownCloud
*
* @author Viktor Scharf <v.scharf@owncloud.com>
* @copyright Copyright (c) 2022 Viktor Scharf v.scharf@owncloud.com
*/
use Behat\Behat\Context\Context ;
use Behat\Behat\Hook\Scope\BeforeScenarioScope ;
use Behat\Gherkin\Node\TableNode ;
2024-10-08 12:26:40 +05:45
use GuzzleHttp\Exception\GuzzleException ;
2025-06-12 17:41:44 +05:45
use GuzzleHttp\Exception\ClientException ;
2024-04-05 11:31:46 +05:45
use PHPUnit\Framework\Assert ;
2024-12-24 15:30:14 +05:45
use Psr\Http\Message\ResponseInterface ;
2024-05-30 17:07:09 +05:45
use TestHelpers\WebDavHelper ;
2024-10-08 12:26:40 +05:45
use TestHelpers\BehatHelper ;
2022-08-23 17:05:12 +05:45
require_once 'bootstrap.php' ;
/**
* Context for the TUS-specific steps using the Graph API
*/
class SpacesTUSContext implements Context {
private FeatureContext $featureContext ;
private TUSContext $tusContext ;
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 from here
2024-10-08 12:26:40 +05:45
$this -> featureContext = BehatHelper :: getContext ( $scope , $environment , 'FeatureContext' );
$this -> spacesContext = BehatHelper :: getContext ( $scope , $environment , 'SpacesContext' );
$this -> tusContext = BehatHelper :: getContext ( $scope , $environment , 'TUSContext' );
2022-08-23 17:05:12 +05:45
}
/**
* @Given /^user "([^"]*)" has uploaded a file from "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
*
* @param string $user
* @param string $source
* @param string $destination
* @param string $spaceName
*
* @return void
*
* @throws Exception
* @throws GuzzleException
*/
2024-12-24 09:30:42 +05:45
public function userHasUploadedFileViaTusInSpace (
string $user ,
string $source ,
string $destination ,
2025-06-19 15:34:02 +05:45
string $spaceName ,
2024-12-24 09:30:42 +05:45
) : void {
2024-10-07 15:03:16 +05:45
$spaceId = $this -> spacesContext -> getSpaceIdByName ( $user , $spaceName );
2024-12-24 15:30:14 +05:45
$response = $this -> tusContext -> uploadFileUsingTus ( $user , $source , $destination , $spaceId );
2024-04-05 11:31:46 +05:45
$this -> featureContext -> setLastUploadDeleteTime ( \time ());
2024-12-24 15:30:14 +05:45
$this -> featureContext -> theHTTPStatusCodeShouldBe (
[ "201" , "204" ],
"HTTP status code was not 201 or 204 while trying to upload file ' $destination ' for user ' $user '" ,
2025-06-19 15:34:02 +05:45
$response ,
2024-12-24 15:30:14 +05:45
);
2022-08-23 17:05:12 +05:45
}
2025-06-12 17:41:44 +05:45
/**
* @Given /^user "([^"]*)" has tried to upload file "([^"]*)" to "([^"]*)" inside space "([^"]*)" via TUS$/
*
* @param string $user
* @param string $source
* @param string $destination
* @param string $spaceName
*
* @return void
*
* @throws Exception
* @throws GuzzleException
*/
public function userHasTriedToUploadFileInsideSpaceViaTUS (
string $user ,
string $source ,
string $destination ,
2025-06-19 15:34:02 +05:45
string $spaceName ,
2025-06-12 17:41:44 +05:45
) : void {
$spaceId = $this -> spacesContext -> getSpaceIdByName ( $user , $spaceName );
try {
$response = $this -> tusContext -> uploadFileUsingTus (
$user ,
$source ,
$destination ,
$spaceId ,
);
Assert :: fail (
__METHOD__ .
" - Expected an exception, but the upload was successful. Status: " .
2025-06-19 15:34:02 +05:45
$response -> getStatusCode (),
2025-06-12 17:41:44 +05:45
);
} catch ( ClientException $e ) {
if ( ! \str_contains ( $e -> getMessage (), "403 Forbidden" )) {
Assert :: fail ( __METHOD__ . " - " . $e -> getMessage ());
}
}
}
2022-08-23 17:05:12 +05:45
/**
* @When /^user "([^"]*)" uploads a file from "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
*
* @param string $user
* @param string $source
* @param string $destination
2022-09-06 12:32:56 +05:45
* @param string $spaceName
2022-08-23 17:05:12 +05:45
*
* @return void
* @throws Exception
* @throws GuzzleException
*/
public function userUploadsAFileViaTusInsideOfTheSpaceUsingTheWebdavApi (
string $user ,
string $source ,
string $destination ,
2025-06-19 15:34:02 +05:45
string $spaceName ,
2022-08-23 17:05:12 +05:45
) : void {
2024-10-07 15:03:16 +05:45
$spaceId = $this -> spacesContext -> getSpaceIdByName ( $user , $spaceName );
2024-12-24 15:30:14 +05:45
$response = $this -> tusContext -> uploadFileUsingTus ( $user , $source , $destination , $spaceId );
$this -> featureContext -> setLastUploadDeleteTime ( \time ());
$this -> featureContext -> setResponse ( $response );
}
/**
* @When the public uploads file :source to :destination via TUS inside last link shared folder with password :password using the WebDAV API
*
* @param string $source
* @param string $destination
* @param string $password
*
* @return void
* @throws Exception|GuzzleException
*/
public function thePublicUploadsFileViaTusInsideLastSharedFolderWithPasswordUsingTheWebdavApi (
string $source ,
string $destination ,
2025-06-19 15:34:02 +05:45
string $password ,
2024-12-24 15:30:14 +05:45
) : void {
$response = $this -> tusContext -> publicUploadFileUsingTus ( $source , $destination , $password );
2024-04-05 11:31:46 +05:45
$this -> featureContext -> setLastUploadDeleteTime ( \time ());
2024-12-24 15:30:14 +05:45
$this -> featureContext -> setResponse ( $response );
2022-08-23 17:05:12 +05:45
}
/**
2024-10-24 12:30:50 +05:45
* @Given user :user has created a new TUS resource in the space :spaceName with the following headers:
2022-08-23 17:05:12 +05:45
*
* @param string $user
* @param string $spaceName
* @param TableNode $headers
*
* @return void
*
* @throws Exception
* @throws GuzzleException
*/
public function userHasCreatedANewTusResourceForTheSpaceUsingTheWebdavApiWithTheseHeaders (
string $user ,
string $spaceName ,
2025-06-19 15:34:02 +05:45
TableNode $headers ,
2022-08-23 17:05:12 +05:45
) : void {
2024-10-07 15:03:16 +05:45
$spaceId = $this -> spacesContext -> getSpaceIdByName ( $user , $spaceName );
2024-10-24 12:30:50 +05:45
$response = $this -> tusContext -> createNewTUSResourceWithHeaders ( $user , $headers , '' , $spaceId );
2023-10-12 16:30:51 +05:45
$this -> featureContext -> theHTTPStatusCodeShouldBe ( 201 , "Expected response status code should be 201" , $response );
2022-08-23 17:05:12 +05:45
}
/**
2023-01-06 08:59:02 +01:00
* @When user :user creates a new TUS resource for the space :spaceName with content :content using the WebDAV API with these headers:
2022-08-23 17:05:12 +05:45
*
* @param string $user
* @param string $spaceName
2023-01-06 08:59:02 +01:00
* @param string $content
2022-08-23 17:05:12 +05:45
* @param TableNode $headers
*
* @return void
*
* @throws Exception
* @throws GuzzleException
*/
public function userCreatesANewTusResourceForTheSpaceUsingTheWebdavApiWithTheseHeaders (
string $user ,
string $spaceName ,
2023-01-06 08:59:02 +01:00
string $content ,
2025-06-19 15:34:02 +05:45
TableNode $headers ,
2022-08-23 17:05:12 +05:45
) : void {
2024-10-07 15:03:16 +05:45
$spaceId = $this -> spacesContext -> getSpaceIdByName ( $user , $spaceName );
2024-09-18 11:26:20 +05:45
$response = $this -> tusContext -> createNewTUSResourceWithHeaders ( $user , $headers , $content , $spaceId );
2023-09-25 13:32:42 +05:45
$this -> featureContext -> setResponse ( $response );
2022-08-23 17:05:12 +05:45
}
/**
2024-05-16 15:03:21 +05:45
* Uploads a file with content to the specified space using the TUS protocol via the WebDAV API.
2022-08-23 17:05:12 +05:45
*
* @param string $user
* @param string $content
* @param string $resource
* @param string $spaceName
*
2024-12-24 15:30:14 +05:45
* @return ResponseInterface
2022-08-23 17:05:12 +05:45
* @throws Exception|GuzzleException
*/
2024-12-24 15:30:14 +05:45
private function uploadFileViaTus (
string $user ,
string $content ,
string $resource ,
2025-06-19 15:34:02 +05:45
string $spaceName ,
2024-12-24 15:30:14 +05:45
) : ResponseInterface {
2025-05-12 09:53:16 +05:45
$spaceId = $this -> spacesContext -> getSpaceIdByName ( $user , $spaceName );
2024-04-05 11:31:46 +05:45
$tmpFile = $this -> tusContext -> writeDataToTempFile ( $content );
2024-12-24 15:30:14 +05:45
$response = $this -> tusContext -> uploadFileUsingTus (
$user ,
\basename ( $tmpFile ),
$resource ,
2025-06-19 15:34:02 +05:45
$spaceId ,
2024-12-24 15:30:14 +05:45
);
$this -> featureContext -> setLastUploadDeleteTime ( \time ());
2024-04-05 11:31:46 +05:45
\unlink ( $tmpFile );
2024-12-24 15:30:14 +05:45
return $response ;
2022-08-23 17:05:12 +05:45
}
2022-08-23 09:26:30 +05:45
2024-10-24 12:30:50 +05:45
/**
* @When /^user "([^"]*)" uploads a file with content "([^"]*)" to "([^"]*)" inside federated share "([^"]*)" via TUS using the WebDAV API$/
*
* @param string $user
* @param string $content
* @param string $file
* @param string $destination
*
* @return void
* @throws Exception|GuzzleException
*/
2024-12-24 09:30:42 +05:45
public function userUploadsAFileWithContentToInsideFederatedShareViaTusUsingTheWebdavApi (
string $user ,
string $content ,
string $file ,
2025-06-19 15:34:02 +05:45
string $destination ,
2024-12-24 09:30:42 +05:45
) : void {
2024-10-24 12:30:50 +05:45
$remoteItemId = $this -> spacesContext -> getSharesRemoteItemId ( $user , $destination );
$remoteItemId = \rawurlencode ( $remoteItemId );
$tmpFile = $this -> tusContext -> writeDataToTempFile ( $content );
2024-12-24 15:30:14 +05:45
$response = $this -> tusContext -> uploadFileUsingTus (
2024-10-24 12:30:50 +05:45
$user ,
\basename ( $tmpFile ),
$file ,
2025-06-19 15:34:02 +05:45
$remoteItemId ,
2024-10-24 12:30:50 +05:45
);
$this -> featureContext -> setLastUploadDeleteTime ( \time ());
\unlink ( $tmpFile );
2024-12-24 15:30:14 +05:45
$this -> featureContext -> setResponse ( $response );
2024-10-24 12:30:50 +05:45
}
2024-05-16 15:03:21 +05:45
/**
* @When /^user "([^"]*)" uploads a file with content "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
*
* @param string $user
* @param string $content
* @param string $resource
* @param string $spaceName
*
* @return void
* @throws Exception|GuzzleException
*/
public function userUploadsAFileWithContentToViaTusInsideOfTheSpaceUsingTheWebdavApi (
string $user ,
string $content ,
string $resource ,
2025-06-19 15:34:02 +05:45
string $spaceName ,
2024-05-16 15:03:21 +05:45
) : void {
2025-05-11 09:55:16 +05:45
$isSpacesDavPathVersion = $this -> featureContext -> getDavPathVersion () === WebDavHelper :: DAV_VERSION_SPACES ;
2025-05-12 09:53:16 +05:45
$resource = \ltrim ( $resource , "/" );
if ( ! $isSpacesDavPathVersion && $spaceName === 'Shares' && ! \str_starts_with ( $resource , "Shares/" )) {
2025-05-11 09:55:16 +05:45
$resource = 'Shares/' . $resource ;
2025-05-12 09:53:16 +05:45
} elseif ( $isSpacesDavPathVersion && \str_starts_with ( $resource , "Shares/" )) {
$resource = \preg_replace ( "/^Shares\//" , "" , $resource );
2025-05-11 09:55:16 +05:45
}
2024-12-24 15:30:14 +05:45
$this -> featureContext -> setResponse ( $this -> uploadFileViaTus ( $user , $content , $resource , $spaceName ));
2024-05-16 15:03:21 +05:45
}
2023-05-24 17:12:19 +02:00
/**
2023-10-12 16:30:51 +05:45
* @Given /^user "([^"]*)" has uploaded a file with content "([^"]*)" to "([^"]*)" via TUS inside of the space "([^"]*)"$/
2023-05-24 17:12:19 +02:00
*
* @param string $user
* @param string $content
* @param string $resource
* @param string $spaceName
*
* @return void
* @throws Exception|GuzzleException
*/
public function userHasUploadedAFileWithContentToViaTusInsideOfTheSpace (
string $user ,
string $content ,
string $resource ,
2025-06-19 15:34:02 +05:45
string $spaceName ,
2023-05-24 17:12:19 +02:00
) : void {
2024-12-24 15:30:14 +05:45
$response = $this -> uploadFileViaTus ( $user , $content , $resource , $spaceName );
$this -> featureContext -> theHTTPStatusCodeShouldBe (
[ "201" , "204" ],
"HTTP status code was not 201 or 204 while trying to upload file ' $resource ' for user ' $user '" ,
2025-06-19 15:34:02 +05:45
$response ,
2024-12-24 15:30:14 +05:45
);
2023-05-24 17:12:19 +02:00
}
2022-08-23 09:26:30 +05:45
/**
* @When /^user "([^"]*)" uploads a file "([^"]*)" to "([^"]*)" with mtime "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
*
* @param string $user
* @param string $source
* @param string $destination
2023-04-21 14:59:50 +05:45
* @param string $mtime Time in human-readable format is taken as input which is converted into milliseconds that is used by API
2022-08-23 09:26:30 +05:45
* @param string $spaceName
*
* @return void
*
* @throws Exception
* @throws GuzzleException
*/
public function userUploadsAFileToWithMtimeViaTusInsideOfTheSpaceUsingTheWebdavApi (
string $user ,
string $source ,
string $destination ,
string $mtime ,
2025-06-19 15:34:02 +05:45
string $spaceName ,
2022-08-23 09:26:30 +05:45
) : void {
2023-09-21 17:17:28 +02:00
switch ( $mtime ) {
case "today" :
$mtime = date ( 'Y-m-d' , strtotime ( 'today' ));
break ;
case "yesterday" :
$mtime = date ( 'Y-m-d' , strtotime ( 'yesterday' ));
break ;
case "lastWeek" :
$mtime = date ( 'Y-m-d' , strtotime ( '-7 days' ));
break ;
case "lastMonth" :
2023-10-31 17:34:32 +05:45
$mtime = date ( 'Y-m-d' , strtotime ( 'first day of previous month' ));
2023-09-21 17:17:28 +02:00
break ;
case "lastYear" :
2025-06-19 12:25:20 +05:45
$mtime = date ( 'Y-m-01' , strtotime ( '-1 year' ));
2023-09-21 17:17:28 +02:00
break ;
default :
}
2024-10-07 15:03:16 +05:45
$spaceId = $this -> spacesContext -> getSpaceIdByName ( $user , $spaceName );
2024-04-05 11:31:46 +05:45
$mtime = new DateTime ( $mtime );
$mtime = $mtime -> format ( 'U' );
$user = $this -> featureContext -> getActualUsername ( $user );
2024-12-24 15:30:14 +05:45
$response = $this -> tusContext -> uploadFileUsingTus (
2024-04-05 11:31:46 +05:45
$user ,
$source ,
$destination ,
2024-09-18 11:26:20 +05:45
$spaceId ,
2025-06-19 15:34:02 +05:45
[ 'mtime' => $mtime ],
2024-04-05 11:31:46 +05:45
);
$this -> featureContext -> setLastUploadDeleteTime ( \time ());
2024-12-24 15:30:14 +05:45
$this -> featureContext -> setResponse ( $response );
2022-08-23 09:26:30 +05:45
}
/**
* @Given /^user "([^"]*)" has uploaded file with checksum "([^"]*)" to the last created TUS Location with offset "([^"]*)" and content "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
*
* @param string $user
* @param string $checksum
* @param string $offset
* @param string $content
* @param string $spaceName
*
* @return void
* @throws Exception|GuzzleException
2024-12-24 09:30:42 +05:45
* @codingStandardsIgnoreStart
2022-08-23 09:26:30 +05:45
*/
public function userHasUploadedFileWithChecksumToTheLastCreatedTusLocationWithOffsetAndContentViaTusInsideOfTheSpaceUsingTheWebdavApi (
2024-12-24 09:30:42 +05:45
// @codingStandardsIgnoreEnd
2022-08-23 09:26:30 +05:45
string $user ,
string $checksum ,
string $offset ,
string $content ,
2025-06-19 15:34:02 +05:45
string $spaceName ,
2022-08-23 09:26:30 +05:45
) : void {
2024-10-03 11:39:38 +05:45
$resourceLocation = $this -> tusContext -> getLastTusResourceLocation ();
$response = $this -> tusContext -> uploadChunkToTUSLocation ( $user , $resourceLocation , $offset , $content , $checksum );
2024-04-05 11:31:46 +05:45
$this -> featureContext -> theHTTPStatusCodeShouldBe ( 204 , "" , $response );
2022-08-23 09:26:30 +05:45
}
/**
2023-10-12 16:30:51 +05:45
* @When /^user "([^"]*)" uploads file with checksum "([^"]*)" to the last created TUS Location with offset "([^"]*)" and content "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
2022-08-23 09:26:30 +05:45
*
* @param string $user
* @param string $checksum
* @param string $offset
* @param string $content
* @param string $spaceName
*
* @return void
* @throws Exception|GuzzleException
2024-12-24 09:30:42 +05:45
* @codingStandardsIgnoreStart
2022-08-23 09:26:30 +05:45
*/
public function userUploadsFileWithChecksumToTheLastCreatedTusLocationWithOffsetAndContentViaTusInsideOfTheSpaceUsingTheWebdavApi (
2024-12-24 09:30:42 +05:45
// @codingStandardsIgnoreEnd
2022-08-23 09:26:30 +05:45
string $user ,
string $checksum ,
string $offset ,
string $content ,
2025-06-19 15:34:02 +05:45
string $spaceName ,
2022-08-23 09:26:30 +05:45
) : void {
2024-10-03 11:39:38 +05:45
$resourceLocation = $this -> tusContext -> getLastTusResourceLocation ();
$response = $this -> tusContext -> uploadChunkToTUSLocation ( $user , $resourceLocation , $offset , $content , $checksum );
2023-10-12 16:30:51 +05:45
$this -> featureContext -> setResponse ( $response );
2022-08-23 09:26:30 +05:45
}
/**
* @When /^user "([^"]*)" sends a chunk to the last created TUS Location with offset "([^"]*)" and data "([^"]*)" with checksum "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
*
* @param string $user
* @param string $offset
* @param string $data
* @param string $checksum
* @param string $spaceName
*
* @return void
* @throws Exception|GuzzleException
2024-12-24 09:30:42 +05:45
* @codingStandardsIgnoreStart
2022-08-23 09:26:30 +05:45
*/
public function userSendsAChunkToTheLastCreatedTusLocationWithOffsetAndDataWithChecksumViaTusInsideOfTheSpaceUsingTheWebdavApi (
2024-12-24 09:30:42 +05:45
// @codingStandardsIgnoreEnd
2022-08-23 09:26:30 +05:45
string $user ,
string $offset ,
string $data ,
string $checksum ,
2025-06-19 15:34:02 +05:45
string $spaceName ,
2022-08-23 09:26:30 +05:45
) : void {
2024-10-03 11:39:38 +05:45
$resourceLocation = $this -> tusContext -> getLastTusResourceLocation ();
$response = $this -> tusContext -> uploadChunkToTUSLocation ( $user , $resourceLocation , $offset , $data , $checksum );
2024-04-05 11:31:46 +05:45
$this -> featureContext -> setResponse ( $response );
2022-08-23 09:26:30 +05:45
}
2024-02-23 11:47:52 +01:00
/**
2024-10-24 12:30:50 +05:45
* @When /^user "([^"]*)" sends a chunk to the last created TUS Location with data "([^"]*)" with the following headers:$/
2024-02-23 11:47:52 +01:00
*
* @param string $user
* @param string $data
* @param TableNode $headers
*
* @return void
* @throws Exception|GuzzleException
*/
public function userSendsAChunkToTheLastCreatedTusLocationWithDataInsideOfTheSpaceWithHeaders (
string $user ,
string $data ,
2025-06-19 15:34:02 +05:45
TableNode $headers ,
2024-02-23 11:47:52 +01:00
) : void {
$rows = $headers -> getRowsHash ();
2024-10-03 11:39:38 +05:45
$resourceLocation = $this -> tusContext -> getLastTusResourceLocation ();
2024-12-24 09:30:42 +05:45
$response = $this -> tusContext -> uploadChunkToTUSLocation (
$user ,
$resourceLocation ,
$rows [ 'Upload-Offset' ],
$data ,
$rows [ 'Upload-Checksum' ],
2025-06-19 15:34:02 +05:45
[ 'Origin' => $rows [ 'Origin' ]],
2024-12-24 09:30:42 +05:45
);
2024-02-23 11:47:52 +01:00
$this -> featureContext -> setResponse ( $response );
}
2022-08-23 09:26:30 +05:45
/**
* @When /^user "([^"]*)" overwrites recently shared file with offset "([^"]*)" and data "([^"]*)" with checksum "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API with these headers:$/
*
* @param string $user
* @param string $offset
* @param string $data
* @param string $checksum
* @param string $spaceName
* @param TableNode $headers
*
* @return void
* @throws GuzzleException
2024-12-24 09:30:42 +05:45
* @codingStandardsIgnoreStart
2022-08-23 09:26:30 +05:45
*/
public function userOverwritesRecentlySharedFileWithOffsetAndDataWithChecksumViaTusInsideOfTheSpaceUsingTheWebdavApiWithTheseHeaders (
2024-12-24 09:30:42 +05:45
// @codingStandardsIgnoreEnd
2022-08-23 09:26:30 +05:45
string $user ,
string $offset ,
string $data ,
string $checksum ,
string $spaceName ,
2025-06-19 15:34:02 +05:45
TableNode $headers ,
2022-08-23 09:26:30 +05:45
) : void {
2024-10-07 15:03:16 +05:45
$spaceId = $this -> spacesContext -> getSpaceIdByName ( $user , $spaceName );
2024-09-18 11:26:20 +05:45
$createResponse = $this -> tusContext -> createNewTUSResource ( $user , $headers , $spaceId );
2024-04-05 11:31:46 +05:45
$this -> featureContext -> theHTTPStatusCodeShouldBe ( 201 , "" , $createResponse );
2024-10-03 11:39:38 +05:45
$resourceLocation = $this -> tusContext -> getLastTusResourceLocation ();
$response = $this -> tusContext -> uploadChunkToTUSLocation ( $user , $resourceLocation , $offset , $data , $checksum );
2024-04-05 11:31:46 +05:45
$this -> featureContext -> setResponse ( $response );
2022-08-23 09:26:30 +05:45
}
/**
* @Then /^as "([^"]*)" the mtime of the file "([^"]*)" in space "([^"]*)" should be "([^"]*)"$/
*
* @param string $user
* @param string $resource
* @param string $spaceName
* @param string $mtime
*
* @return void
* @throws Exception|GuzzleException
*/
public function theMtimeOfTheFileInSpaceShouldBe (
string $user ,
string $resource ,
string $spaceName ,
2025-06-19 15:34:02 +05:45
string $mtime ,
2022-08-23 09:26:30 +05:45
) : void {
2024-10-07 15:03:16 +05:45
$spaceId = $this -> spacesContext -> getSpaceIdByName ( $user , $spaceName );
2024-05-30 17:07:09 +05:45
$mtime = new DateTime ( $mtime );
Assert :: assertEquals (
$mtime -> format ( 'U' ),
WebDavHelper :: getMtimeOfResource (
$this -> featureContext -> getActualUsername ( $user ),
$this -> featureContext -> getPasswordForUser ( $user ),
$this -> featureContext -> getBaseUrl (),
$resource ,
2024-09-18 11:26:20 +05:45
$this -> featureContext -> getDavPathVersion (),
$spaceId ,
2025-06-19 15:34:02 +05:45
),
2024-05-30 17:07:09 +05:45
);
2022-08-23 09:26:30 +05:45
}
2022-08-23 17:05:12 +05:45
}