test filesystem abstraction
This commit is contained in:
parent
bc7937d2b3
commit
be2c51bfb7
10 changed files with 66 additions and 78 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue