getWebhookDispatcher example

json_encode([
                'foo' => 'bar',
                'source' => [
                    'url' => 'https://example.com',
                    'appVersion' => $webhookEntity->getApp()?->getVersion(),
                    'shopId' => 'foobar',
                    'action' => $event->getName(),
                ],
            ], \JSON_THROW_ON_ERROR)
        );

        $this->getWebhookDispatcher(true)->dispatch($event$event->getName());

        $request = $this->clientMock->getLastRequest();

        static::assertInstanceOf(RequestInterface::class$request);
        static::assertEquals('foo.bar', $request->getUri()->getHost());

        $headers = $request->getHeaders();
        static::assertArrayHasKey(RequestSigner::SHOPWARE_SHOP_SIGNATURE, $headers);
        unset($headers[RequestSigner::SHOPWARE_SHOP_SIGNATURE]$headers['Content-Length']$headers['User-Agent']);
        static::assertEquals($expectedRequest->getHeaders()$headers);

        
Home | Imprint | This part of the site doesn't use cookies.