downloads

This commit is contained in:
2024-01-11 12:39:51 +00:00
parent d719bc283c
commit c7cd2fbbca
2 changed files with 50 additions and 13 deletions

View File

@@ -17,7 +17,7 @@ class MultiDownloaderClientTest extends TestCase
return $reflection->getValue($object);
}
public function testRequest()
public function testDownloadAsString()
{
$client = new MultiDownloaderClient();
@@ -26,9 +26,30 @@ class MultiDownloaderClientTest extends TestCase
new FileRequest('https://s3.eu-central-1.wasabisys.com/dev-data-nwb/multi-downloader-sat/tests/img/watermarks/paysage.png')
];
$response = $client->download($files);
$response = $client->downloadAsString($files);
var_dump($response);
$md5 = md5($response);
$this->assertEquals('ea9726d2ecbe6b820899ba125bf0ae94', $md5);
}
public function testDownloadTo()
{
$client = new MultiDownloaderClient();
$files = [
new FileRequest('https://s3.eu-central-1.wasabisys.com/dev-data-nwb/multi-downloader-sat/tests/img/watermarks/portrait.png'),
new FileRequest('https://s3.eu-central-1.wasabisys.com/dev-data-nwb/multi-downloader-sat/tests/img/watermarks/paysage.png')
];
$path = sys_get_temp_dir() . '/testDownloadTo.zip';
$client->downloadTo($path, $files);
$md5 = md5_file($path);
$this->assertFileExists($path);
$this->assertEquals('ea9726d2ecbe6b820899ba125bf0ae94', $md5);
}
public function testApiKeyEnv()