class FakeFileGateway implements FileGateway

Properties

protected int $currentResponseIndex
protected bool $preventStrayOperations

Methods

__construct(Closure|array $responses = [])

Create a file gateway with fake responses.

getFile(FileProvider $provider, string $fileId)

Get a file by its ID.

nextGetResponse(string $fileId)

Get the next response for a get request.

marshalGetResponse(mixed $response, string $fileId)

Marshal the given response into a FileResponse instance.

putFile(FileProvider $provider, StorableFile $file)

Store the given file.

void
deleteFile(FileProvider $provider, string $fileId)

Delete a file by its ID.

preventStrayOperations(bool $prevent = true)

Indicate that an exception should be thrown if any file operation is not faked.

Details

at line 26
__construct(Closure|array $responses = [])

Create a file gateway with fake responses.

Parameters

Closure|array $responses

at line 34
FileResponse getFile(FileProvider $provider, string $fileId)

Get a file by its ID.

Parameters

FileProvider $provider
string $fileId

Return Value

FileResponse

at line 42
protected FileResponse nextGetResponse(string $fileId)

Get the next response for a get request.

Parameters

string $fileId

Return Value

FileResponse

at line 60
protected FileResponse marshalGetResponse(mixed $response, string $fileId)

Marshal the given response into a FileResponse instance.

Parameters

mixed $response
string $fileId

Return Value

FileResponse

at line 84
StoredFileResponse putFile(FileProvider $provider, StorableFile $file)

Store the given file.

Parameters

FileProvider $provider
StorableFile $file

Return Value

StoredFileResponse

at line 94
void deleteFile(FileProvider $provider, string $fileId)

Delete a file by its ID.

Parameters

FileProvider $provider
string $fileId

Return Value

void

at line 104
FakeFileGateway preventStrayOperations(bool $prevent = true)

Indicate that an exception should be thrown if any file operation is not faked.

When the shared manager holds this fake gateway, the setting affects every request in the worker.

Parameters

bool $prevent

Return Value

FakeFileGateway