test filesystem abstraction

This commit is contained in:
Yisroel Baum 2026-06-26 08:23:17 +03:00
parent bc7937d2b3
commit be2c51bfb7
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
10 changed files with 66 additions and 78 deletions

View file

@ -1,36 +0,0 @@
<?php
namespace Tests\Fakes;
use App\Shared\Files\FileToUpload;
use App\Shared\Files\FileUploader;
class FakeFileUploader implements FileUploader
{
/**
* @var array<int, array{file: FileToUpload, folder: string}>
*/
public array $uploads = [];
/**
* @var string[]
*/
public array $deletedPaths = [];
public function upload(FileToUpload $file, string $folder): string
{
$this->uploads[] = ['file' => $file, 'folder' => $folder];
return $folder . '/fake-' . $file->getOriginalName();
}
public function url(string $path): string
{
return 'https://test.local/storage/' . $path;
}
public function delete(string $path): void
{
$this->deletedPaths[] = $path;
}
}