Created
February 24, 2022 19:47
-
-
Save eduPHP/089ad67aa5980722c6cddd6353d0cf43 to your computer and use it in GitHub Desktop.
Guzzle Stub for testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Tests\stubs; | |
| use GuzzleHttp\Client; | |
| class HttpClientStub extends Client | |
| { | |
| static $options = []; | |
| static $uri = []; | |
| static $method = []; | |
| public function __construct(array $config = []) | |
| { | |
| self::$options = collect(); | |
| self::$uri = collect(); | |
| self::$method = collect(); | |
| parent::__construct($config); | |
| } | |
| public function request($method, $uri = '', array $options = []) | |
| { | |
| self::$method->push($method); | |
| self::$uri->push($uri); | |
| self::$options->push($options); | |
| return parent::request($method, $uri, $options); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment