Skip to content

Commit 096fbfe

Browse files
authored
Merge pull request #6 from Sammyjo20/feature/v2-mock-client
Feature | Fixes for beta 3
2 parents be52378 + 9e2c696 commit 096fbfe

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"minimum-stability": "stable",
1919
"require": {
2020
"php": "^8.1",
21-
"sammyjo20/saloon": "2.0.0-beta2"
21+
"sammyjo20/saloon": "2.0.0-beta3"
2222
},
2323
"require-dev": {
2424
"friendsofphp/php-cs-fixer": "^3.13",

src/Http/Middleware/CacheMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __invoke(PendingRequest $pendingRequest): ?SimulatedResponsePayl
6969
// the prepend option, so it runs first.
7070

7171
$pendingRequest->middleware()->onResponse(
72-
closure: new CacheRecorderMiddleware($driver, $this->ttl, $cacheKey),
72+
callable: new CacheRecorderMiddleware($driver, $this->ttl, $cacheKey),
7373
prepend: true,
7474
);
7575

src/Traits/HasCaching.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function bootHasCaching(PendingRequest $pendingRequest): void
6262
// of real responses for caching.
6363

6464
$pendingRequest->middleware()->onRequest(
65-
closure: new CacheMiddleware($cacheDriver, $cacheExpiryInSeconds, $this->cacheKey($pendingRequest), $this->invalidateCache),
65+
callable: new CacheMiddleware($cacheDriver, $cacheExpiryInSeconds, $this->cacheKey($pendingRequest), $this->invalidateCache),
6666
);
6767
}
6868

tests/Feature/CacheTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@
5858
expect($responseA->header('X-Howdy'))->toEqual('Yeehaw');
5959

6060
// Now send a response without the mock middleware, and it should be cached!
61+
// We'll also pass the mock client in here to ensure it's being ignored
6162

62-
$responseB = TestConnector::make()->send(new CachedUserRequest);
63+
$responseB = TestConnector::make()->send(new CachedUserRequest, $mockClient);
6364

6465
expect($responseB->isSimulated())->toBeTrue();
6566
expect($responseB->isCached())->toBeTrue();

0 commit comments

Comments
 (0)