PHPackages                             doppiogancio/mocked-symfony-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. doppiogancio/mocked-symfony-client

ActiveLibrary[Testing &amp; Quality](/categories/testing)

doppiogancio/mocked-symfony-client
==================================

A simple way to mock Symfony clients

v1.0.4(1y ago)44.6kMITPHPPHP ^8.1|^8.2

Since Mar 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/doppiogancio/mocked-symfony-client)[ Packagist](https://packagist.org/packages/doppiogancio/mocked-symfony-client)[ RSS](/packages/doppiogancio-mocked-symfony-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (7)Versions (6)Used By (0)

Mocked Symfony Client
=====================

[](#mocked-symfony-client)

[![Packagist Version](https://camo.githubusercontent.com/f372947179682b53a1cce9e9ec795e0be38c2f2cb6ba5c601afa93b303a51b0f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f7070696f67616e63696f2f6d6f636b65642d73796d666f6e792d636c69656e74)](https://packagist.org/packages/doppiogancio/mocked-symfony-client)[![Packagist Downloads](https://camo.githubusercontent.com/b110ef2acf580a4c62d382fe9145eb030b578f7861070f6edc906a533771a8d3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f646f7070696f67616e63696f2f6d6f636b65642d73796d666f6e792d636c69656e74)](https://packagist.org/packages/doppiogancio/mocked-symfony-client)

Mocked Client
=============

[](#mocked-client)

This package will help test components that depend on Symfony HTTP clients for HTTP calls. At the moment only Guzzle Client is supported.

Install
-------

[](#install)

Via Composer

```
$ composer require doppiogancio/mocked-symfony-client
```

Requirements
------------

[](#requirements)

This version requires a minimum PHP version 8.1

How to mock a client
--------------------

[](#how-to-mock-a-client)

My advice is to create one `injectClient` private method in a TestCase class that will handler every request of a single client. If you have multiple clients, you could use of single mocked client instance, but it would be better to one mocked client for each client used in the code.

```
