feat: MailJet list handling with DOI, webhook receiver and API endpoint
addresses #869cut134
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user