From 23e7913fb0641714c4149b274838f921fbbb5cec Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Sat, 23 Feb 2019 09:18:47 +0100 Subject: [PATCH] allow to set any type of client on the MockFactory and make the factory final --- CHANGELOG.md | 6 ++++++ ClientFactory/MockFactory.php | 11 +++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0206a44d..61daf3a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee - Removed `twig/twig` dependency +### Fixed + +- MockFactory now accepts any client, e.g. a mock client decorated with the + plugin client for the development panel, so that configuring a mock client + actually works. The MockFactory is now `final`. + ## 1.14.0 ### Added diff --git a/ClientFactory/MockFactory.php b/ClientFactory/MockFactory.php index 25ca938b..c56d38c9 100644 --- a/ClientFactory/MockFactory.php +++ b/ClientFactory/MockFactory.php @@ -2,22 +2,25 @@ namespace Http\HttplugBundle\ClientFactory; +use Http\Client\HttpClient; use Http\Mock\Client; /** * @author Gary PEGEOT */ -class MockFactory implements ClientFactory +final class MockFactory implements ClientFactory { /** - * @var Client + * @var HttpClient */ private $client; /** - * @param Client $client + * Set the client instance that this factory should return. + * + * Note that this can be any client, not only a mock client. */ - public function setClient(Client $client) + public function setClient(HttpClient $client) { $this->client = $client; }