Skip to content

Add MockClient::withoutCache() - #548

Merged
Sammyjo20 merged 1 commit into
saloonphp:v4from
JonPurvis:fix/547-fake-without-cache
Sep 18, 2026
Merged

Sammyjo20 merged 1 commit into
saloonphp:v4from
JonPurvis:fix/547-fake-without-cache

Conversation

@JonPurvis

@JonPurvis JonPurvis commented Apr 12, 2026 •

Copy link
Copy Markdown
Contributor

Important

Merge this one first and then the Cache plugin

Sister PR: saloonphp/cache-plugin#18
Fixes: #547

When the response cache plugin runs, it can read and write cached payloads before mocked responses are resolved again. That makes fixture-based mocks appear stuck after the first request.

This PR adds an explicit opt-out on MockClient:

  • withoutCache(): mark this mock client so downstream code can skip response caching
  • shouldBypassResponseCache(): query that flag (used by the cache plugin)

Saloon::fake([...])->withoutCache() continues to work because the Laravel helper returns the global MockClient.

This PR also Includes a unit test covering the addition.

@Sammyjo20
Sammyjo20 merged commit 1573116 into saloonphp:v4 Sep 18, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable caching in tests

2 participants