feat: MailJet list handling with DOI, webhook receiver and API endpoint

addresses #869cut134
This commit is contained in:
Björn Fromme
2026-04-29 09:51:57 +02:00
parent df7885ca1c
commit e4ef2f7adc
46 changed files with 3389 additions and 322 deletions
@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace App\Tests\Controller\Webhook;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class MailjetNewsletterWebhookSecurityTest extends WebTestCase
{
public function testWebhookRequiresBasicAuthentication(): void
{
$client = self::createClient([], [
'HTTPS' => 'on',
]);
$client->request(
'POST',
'/webhooks/mailjet/newsletter',
server: ['CONTENT_TYPE' => 'application/json'],
content: json_encode(['event' => 'open'], JSON_THROW_ON_ERROR),
);
self::assertResponseStatusCodeSame(401);
}
public function testWebhookAcceptsValidBasicAuthentication(): void
{
$client = self::createClient([], [
'HTTPS' => 'on',
'PHP_AUTH_USER' => 'mailjet',
'PHP_AUTH_PW' => 'secret',
]);
$client->request(
'POST',
'/webhooks/mailjet/newsletter',
server: ['CONTENT_TYPE' => 'application/json'],
content: json_encode(['event' => 'open'], JSON_THROW_ON_ERROR),
);
self::assertResponseIsSuccessful();
}
}