|
13 | 13 |
|
14 | 14 | use PHPUnit\Framework\TestCase;
|
15 | 15 | use Symfony\Component\HttpClient\MockHttpClient;
|
| 16 | +use Symfony\Component\HttpClient\Response\JsonMockResponse; |
16 | 17 | use Symfony\Component\HttpClient\Response\MockResponse;
|
17 | 18 | use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunApiTransport;
|
18 | 19 | use Symfony\Component\Mailer\Envelope;
|
@@ -135,7 +136,7 @@ public function testSend()
|
135 | 136 | $this-> assertStringContainsString( '"Fabien" <[email protected]>', $content);
|
136 | 137 | $this->assertStringContainsString('Hello There!', $content);
|
137 | 138 |
|
138 |
| - return new MockResponse(json_encode(['id' => 'foobar']), [ |
| 139 | + return new JsonMockResponse(['id' => 'foobar'], [ |
139 | 140 | 'http_code' => 200,
|
140 | 141 | ]);
|
141 | 142 | });
|
@@ -164,7 +165,7 @@ public function testSendWithMultipleTagHeaders()
|
164 | 165 | $this->assertStringContainsString("Content-Disposition: form-data; name=\"o:tag\"\r\n\r\npassword-reset\r\n", $content);
|
165 | 166 | $this->assertStringContainsString("Content-Disposition: form-data; name=\"o:tag\"\r\n\r\nproduct-name\r\n", $content);
|
166 | 167 |
|
167 |
| - return new MockResponse(json_encode(['id' => 'foobar2']), [ |
| 168 | + return new JsonMockResponse(['id' => 'foobar2'], [ |
168 | 169 | 'http_code' => 200,
|
169 | 170 | ]);
|
170 | 171 | });
|
@@ -192,11 +193,8 @@ public function testSendThrowsForErrorResponse()
|
192 | 193 | $this->assertSame('https://api.mailgun.net:8984/v3/symfony/messages', $url);
|
193 | 194 | $this->assertStringContainsStringIgnoringCase('Authorization: Basic YXBpOkFDQ0VTU19LRVk=', $options['headers'][2] ?? $options['request_headers'][1]);
|
194 | 195 |
|
195 |
| - return new MockResponse(json_encode(['message' => 'i\'m a teapot']), [ |
| 196 | + return new JsonMockResponse(['message' => 'i\'m a teapot'], [ |
196 | 197 | 'http_code' => 418,
|
197 |
| - 'response_headers' => [ |
198 |
| - 'content-type' => 'application/json', |
199 |
| - ], |
200 | 198 | ]);
|
201 | 199 | });
|
202 | 200 | $transport = new MailgunApiTransport('ACCESS_KEY', 'symfony', 'us', $client);
|
|
0 commit comments