|
9 | 9 | use Psr\Http\Message\ResponseInterface;
|
10 | 10 | use WordPress\AiClient\Providers\Http\DTO\Request;
|
11 | 11 | use WordPress\AiClient\Providers\Http\DTO\Response;
|
| 12 | +use WordPress\AiClient\Providers\Http\Enums\HttpMethodEnum; |
12 | 13 | use WordPress\AiClient\Providers\Http\HttpTransporter;
|
13 | 14 | use GuzzleHttp\Psr7\Response as Psr7Response;
|
14 | 15 | use GuzzleHttp\Psr7\HttpFactory;
|
@@ -65,7 +66,7 @@ protected function setUp(): void
|
65 | 66 | public function testSendGetRequest(): void
|
66 | 67 | {
|
67 | 68 | // Arrange
|
68 |
| - $request = new Request('GET', 'https://api.example.com/data'); |
| 69 | + $request = new Request(HttpMethodEnum::GET(), 'https://api.example.com/data'); |
69 | 70 | $mockResponse = new Psr7Response(200, ['Content-Type' => 'application/json'], '{"success":true}');
|
70 | 71 | $this->mockClient->addResponse($mockResponse);
|
71 | 72 |
|
@@ -97,7 +98,7 @@ public function testSendPostRequestWithBody(): void
|
97 | 98 | // Arrange
|
98 | 99 | $headers = ['Content-Type' => 'application/json'];
|
99 | 100 | $body = '{"name":"test"}';
|
100 |
| - $request = new Request('POST', 'https://api.example.com/create', $headers, $body); |
| 101 | + $request = new Request(HttpMethodEnum::POST(), 'https://api.example.com/create', $headers, $body); |
101 | 102 |
|
102 | 103 | $mockResponse = new Psr7Response(201, ['Location' => '/resource/123'], '{"id":123}');
|
103 | 104 | $this->mockClient->addResponse($mockResponse);
|
@@ -136,7 +137,7 @@ public function testMultipleHeaderValues(): void
|
136 | 137 | 'Accept' => ['application/json', 'application/xml'],
|
137 | 138 | 'X-Custom' => 'single-value'
|
138 | 139 | ];
|
139 |
| - $request = new Request('GET', 'https://api.example.com', $headers); |
| 140 | + $request = new Request(HttpMethodEnum::GET(), 'https://api.example.com', $headers); |
140 | 141 |
|
141 | 142 | $mockResponse = new Psr7Response(200, ['Set-Cookie' => ['cookie1=value1', 'cookie2=value2']]);
|
142 | 143 | $this->mockClient->addResponse($mockResponse);
|
|
0 commit comments