Rabbi_Gerzi/backend/tests/Fakes/FakeStoredFileReader.php
2026-06-26 08:13:46 +03:00

30 lines
559 B
PHP

<?php
namespace Tests\Fakes;
use App\Shared\Files\StoredFileReader;
class FakeStoredFileReader implements StoredFileReader
{
/**
* @var array<string, string>
*/
private array $filesByPath = [];
/**
* @var string[]
*/
public array $readPaths = [];
public function put(string $path, string $contents): void
{
$this->filesByPath[$path] = $contents;
}
public function read(string $path): ?string
{
$this->readPaths[] = $path;
return $this->filesByPath[$path] ?? null;
}
}