Skip to content

Commit

Permalink
Rafraîchit le logo après upload (#1085)
Browse files Browse the repository at this point in the history
  • Loading branch information
florimondmanca authored Nov 25, 2024
1 parent 5095aa8 commit 344c8c3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public function __invoke(SaveOrganizationLogoCommand $command): void
$this->storage->delete($logo);
}

$organization->setLogo($this->storage->write($folder, 'logo', $command->file));
$organization->setLogo($this->storage->write($folder, $command->file));
}
}
2 changes: 1 addition & 1 deletion src/Application/StorageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

interface StorageInterface
{
public function write(string $folder, string $fileName, UploadedFile $file): string;
public function write(string $folder, UploadedFile $file): string;

public function delete(string $path): void;

Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/Adapter/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public function __construct(
) {
}

public function write(string $folder, string $fileName, UploadedFile $file): string
public function write(string $folder, UploadedFile $file): string
{
$path = \sprintf('%s/%s.%s', $folder, $fileName, $file->getClientOriginalExtension());
$path = \sprintf('%s/%s.%s', $folder, $file->getFilename(), $file->getClientOriginalExtension());
$this->storage->write($path, $file->getContent(), [
'visibility' => 'public',
'directory_visibility' => 'public',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testSave(): void
$this->storage
->expects(self::once())
->method('write')
->with('organizations/496bd752-c217-4625-ba0c-7454dc218516', 'logo', $file)
->with('organizations/496bd752-c217-4625-ba0c-7454dc218516', $file)
->willReturn('organizations/496bd752-c217-4625-ba0c-7454dc218516/logo.png');

$organization
Expand Down

0 comments on commit 344c8c3

Please sign in to comment.