|
5 | 5 | use Http\Client\Common\Plugin\Cache\Generator\SimpleGenerator; |
6 | 6 | use PhpSpec\Wrapper\Collaborator; |
7 | 7 | use Prophecy\Argument; |
8 | | -use Http\Message\StreamFactory; |
9 | 8 | use Http\Promise\FulfilledPromise; |
10 | 9 | use PhpSpec\ObjectBehavior; |
11 | 10 | use Psr\Cache\CacheItemInterface; |
12 | 11 | use Psr\Cache\CacheItemPoolInterface; |
13 | 12 | use Psr\Http\Message\RequestInterface; |
14 | 13 | use Psr\Http\Message\ResponseInterface; |
| 14 | +use Psr\Http\Message\StreamFactoryInterface; |
15 | 15 | use Psr\Http\Message\StreamInterface; |
16 | 16 | use Psr\Http\Message\UriInterface; |
17 | 17 | use Http\Client\Common\Plugin\CachePlugin; |
|
20 | 20 | class CachePluginSpec extends ObjectBehavior |
21 | 21 | { |
22 | 22 | /** |
23 | | - * @var StreamFactory&Collaborator |
| 23 | + * @var StreamFactoryInterface&Collaborator |
24 | 24 | */ |
25 | 25 | private $streamFactory; |
26 | 26 |
|
27 | | - function let(CacheItemPoolInterface $pool, StreamFactory $streamFactory) |
| 27 | + function let(CacheItemPoolInterface $pool, StreamFactoryInterface $streamFactory) |
28 | 28 | { |
29 | 29 | $this->streamFactory = $streamFactory; |
30 | 30 | $this->beConstructedWith($pool, $streamFactory, [ |
@@ -126,7 +126,7 @@ function it_stores_post_requests_when_allowed( |
126 | 126 | RequestInterface $request, |
127 | 127 | UriInterface $uri, |
128 | 128 | ResponseInterface $response, |
129 | | - StreamFactory $streamFactory, |
| 129 | + StreamFactoryInterface $streamFactory, |
130 | 130 | StreamInterface $stream |
131 | 131 | ) { |
132 | 132 | $this->beConstructedWith($pool, $streamFactory, [ |
@@ -181,7 +181,7 @@ function it_does_not_allow_invalid_request_methods( |
181 | 181 | CacheItemInterface $item, |
182 | 182 | RequestInterface $request, |
183 | 183 | ResponseInterface $response, |
184 | | - StreamFactory $streamFactory, |
| 184 | + StreamFactoryInterface $streamFactory, |
185 | 185 | StreamInterface $stream |
186 | 186 | ) { |
187 | 187 | $this |
@@ -312,7 +312,7 @@ function it_adds_etag_and_modfied_since_to_request(CacheItemPoolInterface $pool, |
312 | 312 | $this->handleRequest($request, $next, function () {}); |
313 | 313 | } |
314 | 314 |
|
315 | | - function it_serves_a_cached_response(CacheItemPoolInterface $pool, CacheItemInterface $item, RequestInterface $request, UriInterface $uri, StreamInterface $requestBody, ResponseInterface $response, StreamInterface $stream, StreamFactory $streamFactory) |
| 315 | + function it_serves_a_cached_response(CacheItemPoolInterface $pool, CacheItemInterface $item, RequestInterface $request, UriInterface $uri, StreamInterface $requestBody, ResponseInterface $response, StreamInterface $stream, StreamFactoryInterface $streamFactory) |
316 | 316 | { |
317 | 317 | $httpBody = 'body'; |
318 | 318 |
|
@@ -343,7 +343,7 @@ function it_serves_a_cached_response(CacheItemPoolInterface $pool, CacheItemInte |
343 | 343 | $this->handleRequest($request, $next, function () {}); |
344 | 344 | } |
345 | 345 |
|
346 | | - function it_serves_and_resaved_expired_response(CacheItemPoolInterface $pool, CacheItemInterface $item, RequestInterface $request, UriInterface $uri, StreamInterface $requestStream, ResponseInterface $response, StreamInterface $stream, StreamFactory $streamFactory) |
| 346 | + function it_serves_and_resaved_expired_response(CacheItemPoolInterface $pool, CacheItemInterface $item, RequestInterface $request, UriInterface $uri, StreamInterface $requestStream, ResponseInterface $response, StreamInterface $stream, StreamFactoryInterface $streamFactory) |
347 | 347 | { |
348 | 348 | $httpBody = 'body'; |
349 | 349 |
|
@@ -398,7 +398,7 @@ function it_caches_private_responses_when_allowed( |
398 | 398 | RequestInterface $request, |
399 | 399 | UriInterface $uri, |
400 | 400 | ResponseInterface $response, |
401 | | - StreamFactory $streamFactory, |
| 401 | + StreamFactoryInterface $streamFactory, |
402 | 402 | StreamInterface $stream |
403 | 403 | ) { |
404 | 404 | $this->beConstructedThrough('clientCache', [$pool, $streamFactory, [ |
@@ -452,7 +452,7 @@ function it_does_not_store_responses_of_requests_to_blacklisted_paths( |
452 | 452 | RequestInterface $request, |
453 | 453 | UriInterface $uri, |
454 | 454 | ResponseInterface $response, |
455 | | - StreamFactory $streamFactory, |
| 455 | + StreamFactoryInterface $streamFactory, |
456 | 456 | StreamInterface $stream |
457 | 457 | ) { |
458 | 458 | $this->beConstructedThrough('clientCache', [$pool, $streamFactory, [ |
@@ -498,7 +498,7 @@ function it_stores_responses_of_requests_not_in_blacklisted_paths( |
498 | 498 | RequestInterface $request, |
499 | 499 | UriInterface $uri, |
500 | 500 | ResponseInterface $response, |
501 | | - StreamFactory $streamFactory, |
| 501 | + StreamFactoryInterface $streamFactory, |
502 | 502 | StreamInterface $stream |
503 | 503 | ) { |
504 | 504 | $this->beConstructedThrough('clientCache', [$pool, $streamFactory, [ |
@@ -550,7 +550,7 @@ function it_stores_responses_of_requests_not_in_blacklisted_paths( |
550 | 550 | function it_can_be_initialized_with_custom_cache_key_generator( |
551 | 551 | CacheItemPoolInterface $pool, |
552 | 552 | CacheItemInterface $item, |
553 | | - StreamFactory $streamFactory, |
| 553 | + StreamFactoryInterface $streamFactory, |
554 | 554 | RequestInterface $request, |
555 | 555 | UriInterface $uri, |
556 | 556 | ResponseInterface $response, |
|
0 commit comments