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 1
1
# Change Log
2
2
3
+ ## Unrelesed
4
+
5
+ - Fix MockClientStrategy for provide the mock as an async client too
6
+
3
7
## 1.6.0 - 2019-01-23
4
8
5
9
### Added
Original file line number Diff line number Diff line change 2
2
3
3
namespace spec \Http \Discovery \Strategy ;
4
4
5
+ use Http \Client \HttpAsyncClient ;
5
6
use Http \Client \HttpClient ;
6
7
use Http \Discovery \ClassDiscovery ;
7
8
use Http \Discovery \Strategy \DiscoveryStrategy ;
@@ -22,4 +23,11 @@ function it_should_return_the_mock_client(DiscoveryStrategy $strategy)
22
23
$ candidates ->shouldBeArray ();
23
24
$ candidates ->shouldHaveCount (1 );
24
25
}
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
+ }
25
33
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace Http \Discovery \Strategy ;
4
4
5
+ use Http \Client \HttpAsyncClient ;
5
6
use Http \Client \HttpClient ;
6
7
use Http \Mock \Client as Mock ;
7
8
@@ -17,8 +18,12 @@ final class MockClientStrategy implements DiscoveryStrategy
17
18
*/
18
19
public static function getCandidates ($ type )
19
20
{
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
+ }
23
28
}
24
29
}
You can’t perform that action at this time.
0 commit comments