fileOptions
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-12 13:04:17 +00:00
parent 4ca5d048d9
commit 345e6a0c51
4 changed files with 31 additions and 9 deletions

View File

@@ -15,9 +15,10 @@ class MultiDownloaderClientTest extends TestCase
private function testFiles()
{
return array_map(function ($url) {
return new FileRequest($url);
}, $this->testFiles);
return array_map(function ($url, $i) {
return (new FileRequest($url))
->fileOptions(['name' => 'test' . $i . '.png']);
}, $this->testFiles, array_keys($this->testFiles));
}
public function testDownloadAsString()
@@ -30,14 +31,14 @@ class MultiDownloaderClientTest extends TestCase
$md5 = md5($response);
$this->assertEquals('ea9726d2ecbe6b820899ba125bf0ae94', $md5);
$this->assertEquals('7542c2c2a0750ab9e62d50bbe83d4c1f', $md5);
}
public function testDownloadTo()
{
$client = new MultiDownloaderClient(['apiKey' => 'test', 'apiSecret' => 'test']);
$path = sys_get_temp_dir() . '/testDownloadTo.zip';
$path = __DIR__ . '/testDownloadTo.zip';
$client->setFiles($this->testFiles());
$client->downloadTo($path);
@@ -45,7 +46,7 @@ class MultiDownloaderClientTest extends TestCase
$md5 = md5_file($path);
$this->assertFileExists($path);
$this->assertEquals('ea9726d2ecbe6b820899ba125bf0ae94', $md5);
$this->assertEquals('7542c2c2a0750ab9e62d50bbe83d4c1f', $md5);
}
public function testForm()

BIN
tests/testDownloadTo.zip Normal file

Binary file not shown.