/**
* @dataProvider dataProviderInvalidAccessToken
*/
public function testInvalidAccessToken(ImportExportFileEntity
$fileEntity, string
$accessToken): void
{ static::
expectException(InvalidFileAccessTokenException::
class);
static::
expectExceptionMessage('Access to file denied due to invalid access token'
);
/** @var StaticEntityRepository<EntityCollection<ImportExportFileEntity>> $fileRepository */
$fileRepository =
new StaticEntityRepository([new EntityCollection([$fileEntity])]);
$downloadService =
new DownloadService($this->
createMock(FilesystemOperator::
class),
$fileRepository);
$downloadService->
createFileResponse(Context::
createDefaultContext(),
$fileEntity->
getId(),
$accessToken);
} /**
* @dataProvider dataProviderNotFoundFile
*/
public function testNotFoundFile(ImportExportFileEntity
$fileEntity, string
$accessToken, string
$fileId): void
{ static::
expectException(FileNotFoundException::
class);
static::
expectExceptionMessage(sprintf('Cannot find import/export file with id %s',
$fileId));