Skip to content

Commit 101c68e

Browse files
Sam RapaportNyholm
Sam Rapaport
authored andcommitted
Add Mock Client strategy. (#90)
* Add Mock Client strategy. * Remove unneeded annotations. * Use ::class constant.
1 parent 2659ac1 commit 101c68e

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33

44
## Unreleased
55

6+
### Added
7+
8+
- MockClientStrategy class.
9+
610
## 1.1.1 - 2016-11-27
711

812
### Changed
913

1014
- Made exception messages clearer. `StrategyUnavailableException` is no longer the previous exception to `DiscoveryFailedException`.
11-
- `CommonClassesStrategy` is using `self` instead of `static`. Using `static` makes no sense when `CommonClassesStrategy` is final.
15+
- `CommonClassesStrategy` is using `self` instead of `static`. Using `static` makes no sense when `CommonClassesStrategy` is final.
1216

1317
## 1.1.0 - 2016-10-20
1418

src/Strategy/MockClientStrategy.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Http\Discovery\Strategy;
4+
5+
use Http\Client\HttpClient;
6+
use Http\Mock\Client as Mock;
7+
8+
/**
9+
* Find the Mock client.
10+
*
11+
* @author Sam Rapaport <[email protected]>
12+
*/
13+
final class MockClientStrategy implements DiscoveryStrategy
14+
{
15+
/**
16+
* {@inheritdoc}
17+
*/
18+
public static function getCandidates($type)
19+
{
20+
return ($type === HttpClient::class)
21+
? ['class' => Mock::class, 'condition' => Mock::class]
22+
: [];
23+
}
24+
}

0 commit comments

Comments
 (0)