Skip to content

Update MockFactory.php #315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions ClientFactory/MockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@

namespace Http\HttplugBundle\ClientFactory;

use Http\Client\HttpClient;
use Http\Mock\Client;

/**
* @author Gary PEGEOT <[email protected]>
*/
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically a BC break.

But if I understand it correctly. Using this mock factory has never worked, right?
If so, it would mean that this is a bugfix and I'm 👍

{
$this->client = $client;
}
Expand Down