30 lines
559 B
PHP
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;
|
|
}
|
|
}
|