File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 11# Change Log
22
3+ ## Unrelesed
4+
5+ - Fix MockClientStrategy for provide the mock as an async client too
6+
37## 1.6.0 - 2019-01-23
48
59### Added
Original file line number Diff line number Diff line change 22
33namespace spec \Http \Discovery \Strategy ;
44
5+ use Http \Client \HttpAsyncClient ;
56use Http \Client \HttpClient ;
67use Http \Discovery \ClassDiscovery ;
78use Http \Discovery \Strategy \DiscoveryStrategy ;
@@ -22,4 +23,11 @@ function it_should_return_the_mock_client(DiscoveryStrategy $strategy)
2223 $ candidates ->shouldBeArray ();
2324 $ candidates ->shouldHaveCount (1 );
2425 }
26+
27+ function it_should_return_the_mock_client_as_async (DiscoveryStrategy $ strategy )
28+ {
29+ $ candidates = $ this ->getCandidates (HttpAsyncClient::class);
30+ $ candidates ->shouldBeArray ();
31+ $ candidates ->shouldHaveCount (1 );
32+ }
2533}
Original file line number Diff line number Diff line change 22
33namespace Http \Discovery \Strategy ;
44
5+ use Http \Client \HttpAsyncClient ;
56use Http \Client \HttpClient ;
67use Http \Mock \Client as Mock ;
78
@@ -17,8 +18,12 @@ final class MockClientStrategy implements DiscoveryStrategy
1718 */
1819 public static function getCandidates ($ type )
1920 {
20- return (HttpClient::class === $ type )
21- ? [['class ' => Mock::class, 'condition ' => Mock::class]]
22- : [];
21+ switch ($ type ) {
22+ case HttpClient::class:
23+ case HttpAsyncClient::class:
24+ return [['class ' => Mock::class, 'condition ' => Mock::class]];
25+ default :
26+ return [];
27+ }
2328 }
2429}
You can’t perform that action at this time.
0 commit comments