Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738<?php
declare(strict_types=1);
namespace Wotnak\Atproto\Tests\Support;
use Psr\Http\Message\RequestInterface;use Psr\Http\Message\ResponseInterface;use Wotnak\Atproto\Client\XrpcRequestSenderInterface;
final class TestXrpcRequestSender implements XrpcRequestSenderInterface {
public ?RequestInterface $lastRequest = NULL;
public int $requestCount = 0;
/** @var list<RequestInterface> */ public array $requests = [];
/** * @param list<ResponseInterface> $responses */ public function __construct( private array $responses, ) {}
public function send(RequestInterface $request): ResponseInterface { $this->lastRequest = $request; $this->requests[] = $request; $this->requestCount++; if ($this->responses === []) { throw new \RuntimeException('No test response queued.'); } return \array_shift($this->responses); }
}