Skip to content
Snippets Groups Projects
Commit 01ea251e authored by Neuber, Eugen Ramon's avatar Neuber, Eugen Ramon :speech_balloon:
Browse files

Fix updating existing file data with mock.

parent a0bf9b61
No related branches found
No related tags found
No related merge requests found
......@@ -79,6 +79,7 @@ class FileDataDataProvider extends AbstractDataProvider
$fileData = $this->blobService->setBucket($fileData);
if ($this->requestStack->getCurrentRequest()->getMethod() !== 'DELETE') {
// create shareLink
$fileData = $this->blobService->getLink($fileData);
$this->blobService->saveFileData($fileData);
}
......@@ -118,12 +119,13 @@ class FileDataDataProvider extends AbstractDataProvider
$fileDatas = $this->blobService->getFileDataByBucketIDAndPrefixWithPagination($bucketId, $prefix, $currentPageNumber, $maxNumItemsPerPage);
assertNotNull($this->blobService, 'blob service not initialized');
// create sharelinks
foreach ($fileDatas as $fileData) {
foreach ($fileDatas as &$fileData) {
assert($fileData instanceof FileData);
$fileData->setBucket($bucket);
$fileData = $this->blobService->getLink($fileData);
// $this->blobService->saveFileData($fileData);
$this->blobService->saveFileData($fileData);
}
return $fileDatas;
......
......@@ -52,6 +52,9 @@ class DummyFileSystemService implements DatasystemProviderServiceInterface
return null;
}
$fileData->setContentUrl("https://localhost.lan/link/$identifier");
self::$fd[$identifier] = $fileData;
return self::$fd[$identifier];
}
......@@ -117,7 +120,7 @@ class CurlGetTest extends ApiTestCase
}
/**
* Integration test for get all for a prefix with empty result
* Integration test for get all for a prefix with empty result.
*/
public function testGet(): void
{
......@@ -574,7 +577,7 @@ class CurlGetTest extends ApiTestCase
}
/**
* Integration test: get all with expired token creation time
* Integration test: get all with expired token creation time.
*/
public function testGetExpired(): void
{
......@@ -582,6 +585,11 @@ class CurlGetTest extends ApiTestCase
$client = static::createClient();
$configService = $client->getContainer()->get(ConfigurationService::class);
// =======================================================
// GET a file with expired token
// =======================================================
echo "GET a file with expired token\n";
$bucket = $configService->getBuckets()[0];
$secret = $bucket->getPublicKey();
$bucketId = $bucket->getIdentifier();
......@@ -620,7 +628,7 @@ class CurlGetTest extends ApiTestCase
/**
* Integration test: get and delete blob with unknown id
* Integration test: get and delete blob with unknown id.
*/
public function testGetDeleteByUnknownId(): void
{
......@@ -661,7 +669,7 @@ class CurlGetTest extends ApiTestCase
$client->getKernelBrowser()->followRedirects();
/** @var Response $response */
$response = $client->request('GET', "$url/{$uuid}", $options);
$response = $client->request('GET', $url, $options);
$this->assertEquals(404, $response->getStatusCode());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment