|
2 | 2 |
|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
| 5 | +use Elastic\Elasticsearch\Exception\ClientResponseException; |
| 6 | +use GuzzleHttp\Psr7\Response; |
5 | 7 | use Illuminate\Support\Facades\DB; |
6 | 8 | use PDPhilip\Elasticsearch\Exceptions\QueryException; |
7 | 9 | use PDPhilip\Elasticsearch\Tests\Models\PageHit; |
|
22 | 24 |
|
23 | 25 | it('handles error responses without error.type structure', function () { |
24 | 26 | $body = json_encode(['status' => 400, 'message' => 'Something went wrong']); |
25 | | - $response = new \GuzzleHttp\Psr7\Response(400, [], $body); |
26 | | - $previous = new \Elastic\Elasticsearch\Exception\ClientResponseException($body, 400); |
| 27 | + $response = new Response(400, [], $body); |
| 28 | + $previous = new ClientResponseException($body, 400); |
27 | 29 | $previous->setResponse($response); |
28 | 30 |
|
29 | 31 | $exception = new QueryException($previous); |
|
33 | 35 | }); |
34 | 36 |
|
35 | 37 | it('handles error responses with null json body', function () { |
36 | | - $response = new \GuzzleHttp\Psr7\Response(400, [], 'not json at all'); |
37 | | - $previous = new \Elastic\Elasticsearch\Exception\ClientResponseException('not json at all', 400); |
| 38 | + $response = new Response(400, [], 'not json at all'); |
| 39 | + $previous = new ClientResponseException('not json at all', 400); |
38 | 40 | $previous->setResponse($response); |
39 | 41 |
|
40 | 42 | $exception = new QueryException($previous); |
|
0 commit comments