Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
wthijmen authored and myparcel-bot[bot] committed Nov 7, 2023
1 parent 889ecf6 commit 5c0e8de
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions tests/Unit/App/Webhook/PdkWebhookManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use MyParcelNL\Pdk\Tests\Uses\UsesMockPdkInstance;
use MyParcelNL\Pdk\Webhook\Collection\WebhookSubscriptionCollection;
use MyParcelNL\Pdk\Webhook\Model\WebhookSubscription;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use function MyParcelNL\Pdk\Tests\usesShared;
Expand All @@ -28,6 +29,8 @@
$webhookManager = Pdk::get(PdkWebhookManagerInterface::class);
/** @var \MyParcelNL\Pdk\Tests\Bootstrap\MockCronService $cronService */
$cronService = Pdk::get(CronServiceInterface::class);
/** @var \MyParcelNL\Pdk\Tests\Bootstrap\MockLogger $logger */
$logger = Pdk::get(LoggerInterface::class);

$repository->storeHashedUrl('https://example.com/hashed-url');

Expand Down Expand Up @@ -58,8 +61,8 @@

expect($response->getStatusCode())
->toBe(Response::HTTP_ACCEPTED)
->and($request->headers->all())
->toHaveKey('x-myparcel-hook')
->and($request->headers->get('x-myparcel-hook'))
->toBe($hook)
->and($response->getContent())
->toBe('')
->and($response->getStatusCode())
Expand All @@ -71,12 +74,6 @@
->toBeGreaterThanOrEqual($time - 10)
->and($timestamp)
->toBeLessThanOrEqual($time + 10);

$cronService->executeAllTasks();
expect(
$cronService->getScheduledTasks()
->all()
)->toBeEmpty();
})->with(WebhookSubscription::ALL);

it('dispatches and executes incoming webhook without myparcel header', function (string $hook) {
Expand Down Expand Up @@ -124,10 +121,4 @@
->toBeGreaterThanOrEqual($time - 10)
->and($timestamp)
->toBeLessThanOrEqual($time + 10);

$cronService->executeAllTasks();
expect(
$cronService->getScheduledTasks()
->all()
)->toBeEmpty();
})->with(WebhookSubscription::ALL);

0 comments on commit 5c0e8de

Please sign in to comment.