RecordingProviderClient.php 663 B

123456789101112131415161718
  1. <?php
  2. namespace Tests\Support;
  3. /** Test transport only; provider request building and signing still execute normally. */
  4. class RecordingProviderClient
  5. {
  6. public static array $requests = [];
  7. public static string $responseBody = '{}';
  8. public static ?\Throwable $exception = null;
  9. public function __construct(private array $config = []) {}
  10. public function post(string $url, array $options): \GuzzleHttp\Psr7\Response
  11. {
  12. self::$requests[] = ['url' => $url, 'options' => $options] + $this->config;
  13. if (self::$exception) throw self::$exception;
  14. return new \GuzzleHttp\Psr7\Response(200, [], self::$responseBody);
  15. }
  16. }