Skip to content

Respect MockClient::shouldBypassResponseCache() - #18

Merged
Sammyjo20 merged 5 commits into
saloonphp:v3from
JonPurvis:fix/547-fake-without-cache
Sep 18, 2026
Merged

Sammyjo20 merged 5 commits into
saloonphp:v3from
JonPurvis:fix/547-fake-without-cache

Conversation

@JonPurvis

@JonPurvis JonPurvis commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Sister PR: saloonphp/saloon#548
Fixes: saloonphp/saloon#547

When a MockClient opts out via withoutCache(), the cache middleware should not return a cached fake response or register the cache recorder for that request. Otherwise the first faked response is stored and later sends ignore updated fixtures or mock sequences.

CacheMiddleware now returns early when the pending request鈥檚 mock client reports shouldBypassResponseCache() === true.

Adds feature tests that assert stale fixture behaviour without the opt-out, and fresh fixture reads when withoutCache() is used on the mock client.

Comment thread src/Http/Middleware/CacheMiddleware.php
@Sammyjo20
Sammyjo20 merged commit c5385e6 into saloonphp:v3 Sep 18, 2026
9 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