Skip to content

Commit

Permalink
Remove usage of JsonMockResponse because it's not implemented in SF5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Dec 4, 2024
1 parent 3e8f94c commit e670fa6
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/Functional/Controller/HandleWebhookActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\HttpClient\Psr18Client;
use Symfony\Component\HttpClient\Response\JsonMockResponse;
use Symfony\Component\HttpClient\Response\MockResponse;

final class HandleWebhookActionTest extends WebTestCase
{
Expand All @@ -36,12 +36,18 @@ protected function setUp(): void
*/
public function it_handles_stock_adjustments(): void
{
$httpClient = new MockHttpClient([new JsonMockResponse([new Stock(
productId: 'Everyday_white_basic_T_Shirt',
variantId: 'Everyday_white_basic_T_Shirt-variant-0',
quantity: 2,
reservedQuantity: 0,
)])]);
$httpClient = new MockHttpClient([new MockResponse(json_encode([
new Stock(
productId: 'Everyday_white_basic_T_Shirt',
variantId: 'Everyday_white_basic_T_Shirt-variant-0',
quantity: 2,
reservedQuantity: 0,
),
], \JSON_THROW_ON_ERROR), [
'response_headers' => [
'content-type' => 'application/json',
],
])]);

$peakClient = self::getContainer()->get(Client::class);
$peakClient->setHttpClient(new Psr18Client($httpClient));
Expand Down

0 comments on commit e670fa6

Please sign in to comment.