diff --git a/Tests/Transport/PostmarkApiTransportTest.php b/Tests/Transport/PostmarkApiTransportTest.php index 7cb56fa..0b8b188 100644 --- a/Tests/Transport/PostmarkApiTransportTest.php +++ b/Tests/Transport/PostmarkApiTransportTest.php @@ -13,7 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpClient\MockHttpClient; -use Symfony\Component\HttpClient\Response\MockResponse; +use Symfony\Component\HttpClient\Response\JsonMockResponse; use Symfony\Component\Mailer\Bridge\Postmark\Transport\MessageStreamHeader; use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkApiTransport; use Symfony\Component\Mailer\Envelope; @@ -82,7 +82,7 @@ public function testSend() $this->assertSame('Hello!', $body['Subject']); $this->assertSame('Hello There!', $body['TextBody']); - return new MockResponse(json_encode(['MessageID' => 'foobar']), [ + return new JsonMockResponse(['MessageID' => 'foobar'], [ 'http_code' => 200, ]); }); @@ -102,11 +102,8 @@ public function testSend() public function testSendThrowsForErrorResponse() { - $client = new MockHttpClient(static fn (string $method, string $url, array $options): ResponseInterface => new MockResponse(json_encode(['Message' => 'i\'m a teapot', 'ErrorCode' => 418]), [ + $client = new MockHttpClient(static fn (string $method, string $url, array $options): ResponseInterface => new JsonMockResponse(['Message' => 'i\'m a teapot', 'ErrorCode' => 418], [ 'http_code' => 418, - 'response_headers' => [ - 'content-type' => 'application/json', - ], ])); $transport = new PostmarkApiTransport('KEY', $client); $transport->setPort(8984);