Skip to content

Commit e7842ed

Browse files
chore: minor tests fix
- Source should have been provided as null when the bucket and key are already provided as part of the download request args. - When checksum type will be resolved to FULL_OBJECT the only supported algorithms are CRC family.
1 parent 20ada71 commit e7842ed

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/S3/S3Transfer/S3TransferManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,9 @@ public function downloadDirectory(
476476
$promises[] = $this->downloadFile(
477477
new DownloadFileRequest(
478478
destination: $destinationFile,
479-
failsWhenDestinationExists: ['fails_when_destination_exists'] ?? false,
479+
failsWhenDestinationExists: $config['fails_when_destination_exists'] ?? false,
480480
downloadRequest: new DownloadRequest(
481-
source: $sourceBucket,
481+
source: null, // Source has been provided in the request args
482482
downloadRequestArgs: $requestArgs,
483483
config: [
484484
'target_part_size_bytes' => $config['target_part_size_bytes'] ?? 0,

tests/S3/S3Transfer/S3TransferManagerTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,6 @@ public function testUploadUsesCustomChecksumAlgorithm(
483483
public function uploadUsesCustomChecksumAlgorithmProvider(): array
484484
{
485485
return [
486-
'checksum_sha256' => [
487-
'checksum_algorithm' => 'sha256',
488-
],
489-
'checksum_sha1' => [
490-
'checksum_algorithm' => 'sha1',
491-
],
492486
'checksum_crc32c' => [
493487
'checksum_algorithm' => 'crc32c',
494488
],
@@ -2272,7 +2266,11 @@ public function testDownloadDirectoryUsesFailurePolicy(): void
22722266
)->wait();
22732267
$this->assertTrue($called);
22742268
} finally {
2275-
unlink($destinationDirectory . '/file1.txt');
2269+
$file = $destinationDirectory . '/file1.txt';
2270+
if (file_exists($file)) {
2271+
unlink($file);
2272+
}
2273+
22762274
rmdir($destinationDirectory);
22772275
}
22782276
}

0 commit comments

Comments
 (0)