trait InteractsWithFakeStores

Properties

protected FakeStoreGateway|null $fakeStoreGateway

The fake store gateway instance.

protected array $recordedStoreCreations

All of the recorded store creations.

protected array $recordedStoreDeletions

All of the recorded store deletions.

protected array $recordedFileAdditions

All of the recorded file additions.

protected array $recordedFileRemovals

All of the recorded file removals.

Methods

fakeStores(Closure|array $responses = [])

Fake store operations.

recordStoreCreation(string $name, string|null $description = null, Collection|null $fileIds = null, DateInterval|null $expiresWhenIdleFor = null)

Record a store creation.

recordStoreDeletion(string $storeId)

Record a store deletion.

recordFileAddition(string $storeId, string $fileId, StorableFile|UploadedFile|HasProviderId|string $file)

Record a file addition to a store.

recordFileRemoval(string $storeId, string $fileId)

Record a file removal from a store.

assertStoreCreated(Closure|string $callback)

Assert that a store was created matching a given truth test.

assertStoreNotCreated(Closure|string $callback)

Assert that a store was not created matching a given truth test.

assertNoStoresCreated()

Assert that no stores were created.

assertStoreDeleted(Closure|string $callback)

Assert that a store was deleted matching a given truth test.

assertStoreNotDeleted(Closure|string $callback)

Assert that a store was not deleted matching a given truth test.

assertNoStoresDeleted()

Assert that no stores were deleted.

assertFileAddedToStore(Closure|string $storeId, string|null $fileId = null)

Assert that a file was added to a store matching a given truth test.

assertFileNotAddedToStore(Closure|string $storeId, string|null $fileId = null)

Assert that a file was not added to a store matching a given truth test.

assertFileRemovedFromStore(Closure|string $storeId, string|null $fileId = null)

Assert that a file was removed from a store matching a given truth test.

assertFileNotRemovedFromStore(Closure|string $storeId, string|null $fileId = null)

Assert that a file was not removed from a store matching a given truth test.

fileMatchingCallback(Closure|string $storeId, string|null $fileId)

Get a callback for matching store and file IDs.

bool
fileIdMatches(StorableFile|UploadedFile|HasProviderId|string $file, string|null $expectedFileId)

Determine if the given file matches the expected file ID.

bool
storesAreFaked()

Determine if store operations are faked.

fakeStoreGateway()

Get the fake store gateway.

Details

at line 51
FakeStoreGateway fakeStores(Closure|array $responses = [])

Fake store operations.

On the shared manager, the fake gateway affects every request.

Parameters

Closure|array $responses

Return Value

FakeStoreGateway

at line 62
InteractsWithFakeStores recordStoreCreation(string $name, string|null $description = null, Collection|null $fileIds = null, DateInterval|null $expiresWhenIdleFor = null)

Record a store creation.

Recorded creations remain on the worker-shared manager.

Parameters

string $name
string|null $description
Collection|null $fileIds
DateInterval|null $expiresWhenIdleFor

Return Value

InteractsWithFakeStores

at line 84
InteractsWithFakeStores recordStoreDeletion(string $storeId)

Record a store deletion.

Recorded deletions remain on the worker-shared manager.

Parameters

string $storeId

Return Value

InteractsWithFakeStores

at line 97
InteractsWithFakeStores recordFileAddition(string $storeId, string $fileId, StorableFile|UploadedFile|HasProviderId|string $file)

Record a file addition to a store.

Recorded additions remain on the worker-shared manager.

Parameters

string $storeId
string $fileId
StorableFile|UploadedFile|HasProviderId|string $file

Return Value

InteractsWithFakeStores

at line 117
InteractsWithFakeStores recordFileRemoval(string $storeId, string $fileId)

Record a file removal from a store.

Recorded removals remain on the worker-shared manager.

Parameters

string $storeId
string $fileId

Return Value

InteractsWithFakeStores

at line 131
InteractsWithFakeStores assertStoreCreated(Closure|string $callback)

Assert that a store was created matching a given truth test.

Parameters

Closure|string $callback

Return Value

InteractsWithFakeStores

at line 154
InteractsWithFakeStores assertStoreNotCreated(Closure|string $callback)

Assert that a store was not created matching a given truth test.

Parameters

Closure|string $callback

Return Value

InteractsWithFakeStores

at line 177
InteractsWithFakeStores assertNoStoresCreated()

Assert that no stores were created.

at line 190
InteractsWithFakeStores assertStoreDeleted(Closure|string $callback)

Assert that a store was deleted matching a given truth test.

Parameters

Closure|string $callback

Return Value

InteractsWithFakeStores

at line 208
InteractsWithFakeStores assertStoreNotDeleted(Closure|string $callback)

Assert that a store was not deleted matching a given truth test.

Parameters

Closure|string $callback

Return Value

InteractsWithFakeStores

at line 226
InteractsWithFakeStores assertNoStoresDeleted()

Assert that no stores were deleted.

at line 239
InteractsWithFakeStores assertFileAddedToStore(Closure|string $storeId, string|null $fileId = null)

Assert that a file was added to a store matching a given truth test.

Parameters

Closure|string $storeId
string|null $fileId

Return Value

InteractsWithFakeStores

at line 254
InteractsWithFakeStores assertFileNotAddedToStore(Closure|string $storeId, string|null $fileId = null)

Assert that a file was not added to a store matching a given truth test.

Parameters

Closure|string $storeId
string|null $fileId

Return Value

InteractsWithFakeStores

at line 269
InteractsWithFakeStores assertFileRemovedFromStore(Closure|string $storeId, string|null $fileId = null)

Assert that a file was removed from a store matching a given truth test.

Parameters

Closure|string $storeId
string|null $fileId

Return Value

InteractsWithFakeStores

at line 284
InteractsWithFakeStores assertFileNotRemovedFromStore(Closure|string $storeId, string|null $fileId = null)

Assert that a file was not removed from a store matching a given truth test.

Parameters

Closure|string $storeId
string|null $fileId

Return Value

InteractsWithFakeStores

at line 299
protected Closure fileMatchingCallback(Closure|string $storeId, string|null $fileId)

Get a callback for matching store and file IDs.

Parameters

Closure|string $storeId
string|null $fileId

Return Value

Closure

at line 312
protected bool fileIdMatches(StorableFile|UploadedFile|HasProviderId|string $file, string|null $expectedFileId)

Determine if the given file matches the expected file ID.

Parameters

StorableFile|UploadedFile|HasProviderId|string $file
string|null $expectedFileId

Return Value

bool

at line 328
bool storesAreFaked()

Determine if store operations are faked.

Return Value

bool

at line 336
FakeStoreGateway|null fakeStoreGateway()

Get the fake store gateway.

Return Value

FakeStoreGateway|null