Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Dec 4, 2024
1 parent 5b4a9ce commit 3e8f94c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/Functional/Controller/HandleWebhookActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Tests\Setono\SyliusPeakPlugin\Functional\Controller;

use Setono\PeakWMS\Client\Client;
use Setono\PeakWMS\DataTransferObject\Stock\Stock;
use Setono\SyliusPeakPlugin\Model\OrderInterface;
use Sylius\Component\Core\Model\OrderItemInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;
Expand All @@ -16,6 +18,9 @@
use Sylius\Component\Resource\Factory\FactoryInterface;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\HttpClient\Psr18Client;
use Symfony\Component\HttpClient\Response\JsonMockResponse;

final class HandleWebhookActionTest extends WebTestCase
{
Expand All @@ -31,6 +36,16 @@ protected function setUp(): void
*/
public function it_handles_stock_adjustments(): void
{
$httpClient = new MockHttpClient([new JsonMockResponse([new Stock(

Check failure on line 39 in tests/Functional/Controller/HandleWebhookActionTest.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP8.1 | Deps: lowest | SF~5.4.0)

UndefinedClass

tests/Functional/Controller/HandleWebhookActionTest.php:39:47: UndefinedClass: Class, interface or enum named Symfony\Component\HttpClient\Response\JsonMockResponse does not exist (see https://psalm.dev/019)

Check failure on line 39 in tests/Functional/Controller/HandleWebhookActionTest.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP8.1 | Deps: highest | SF~5.4.0)

UndefinedClass

tests/Functional/Controller/HandleWebhookActionTest.php:39:47: UndefinedClass: Class, interface or enum named Symfony\Component\HttpClient\Response\JsonMockResponse does not exist (see https://psalm.dev/019)

Check failure on line 39 in tests/Functional/Controller/HandleWebhookActionTest.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP8.2 | Deps: highest | SF~5.4.0)

UndefinedClass

tests/Functional/Controller/HandleWebhookActionTest.php:39:47: UndefinedClass: Class, interface or enum named Symfony\Component\HttpClient\Response\JsonMockResponse does not exist (see https://psalm.dev/019)
productId: 'Everyday_white_basic_T_Shirt',
variantId: 'Everyday_white_basic_T_Shirt-variant-0',
quantity: 2,
reservedQuantity: 0,
)])]);

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

self::$client->request(
method: 'POST',
uri: '/peak/webhook?name=100',
Expand All @@ -46,6 +61,8 @@ public function it_handles_stock_adjustments(): void
);

self::assertResponseStatusCodeSame(204);

// todo assert that the actual on hand value on the variant is changed
}

/**
Expand Down

0 comments on commit 3e8f94c

Please sign in to comment.