Download the PHP package webwhales/laravel-guzzle-conditional-mock-handler without Composer
On this page you can find all versions of the php package webwhales/laravel-guzzle-conditional-mock-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webwhales/laravel-guzzle-conditional-mock-handler
More information about webwhales/laravel-guzzle-conditional-mock-handler
Files in webwhales/laravel-guzzle-conditional-mock-handler
Package laravel-guzzle-conditional-mock-handler
Short Description Offers a way to load mocked responses conditionally with Guzzle instead of a fixed queue in Laravel
License MIT
Homepage https://github.com/WebWhales/laravel-guzzle-conditional-mock-handler
Informations about the package laravel-guzzle-conditional-mock-handler
Laravel Conditional Mock Handler for Guzzle
This package offers an easy way to use the Conditional Mock Handler for Guzzle package while writing tests in a Laravel application. The Conditional Mock Handler can be used to load mocked responses conditionally based on the URL, instead of a fixed queue.
Installation
Install this package using composer:
Simple Example
To use the Conditional Mock Handler, you'll have to use the TestWithGuzzleMockHandler
trait in your test. Furthermore,
the Guzzle client has to instantiated by either the Laravel container or Laravel's dependency injection.
See the following example:
You can also use a Guzzle Response
object (or any object implementing the \Psr\Http\Message\ResponseInterface
interface), to give you more control about the response object itself:
Regex example
The Conditional Mock Handler for Guzzle package also supports regex patterns:
License
The this package is open source software licensed under the MIT license
All versions of laravel-guzzle-conditional-mock-handler with dependencies
laravel/framework Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
webwhales/guzzle-conditional-mock-handler Version ^1.0