feat: MailJet list handling with DOI, webhook receiver and API endpoint
addresses #869cut134
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Entity;
|
||||
|
||||
use App\Entity\NewsletterConsent;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class NewsletterConsentTest extends TestCase
|
||||
{
|
||||
public function testConfirmationAndRevocationAreListScoped(): void
|
||||
{
|
||||
$consent = new NewsletterConsent(' [email protected] ', 123, ' Mia ', ' Muster ');
|
||||
|
||||
self::assertSame('[email protected]', $consent->getEmail());
|
||||
self::assertSame(123, $consent->getMailjetListId());
|
||||
self::assertSame('Mia', $consent->getFirstName());
|
||||
self::assertSame('Muster', $consent->getLastName());
|
||||
self::assertFalse($consent->isConfirmed());
|
||||
|
||||
$consent->markConfirmed(new \DateTimeImmutable('2026-04-29 10:00:00'), 'New', null);
|
||||
|
||||
self::assertTrue($consent->isConfirmed());
|
||||
self::assertFalse($consent->isRevoked());
|
||||
self::assertSame('New', $consent->getFirstName());
|
||||
self::assertSame('Muster', $consent->getLastName());
|
||||
|
||||
$consent->markRevoked(new \DateTimeImmutable('2026-04-29 11:00:00'));
|
||||
|
||||
self::assertFalse($consent->isConfirmed());
|
||||
self::assertTrue($consent->isRevoked());
|
||||
|
||||
$consent->markConfirmed(new \DateTimeImmutable('2026-04-29 12:00:00'));
|
||||
|
||||
self::assertTrue($consent->isConfirmed());
|
||||
self::assertFalse($consent->isRevoked());
|
||||
}
|
||||
|
||||
public function testRejectsInvalidMailjetListId(): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Mailjet list ID must be a positive integer.');
|
||||
|
||||
new NewsletterConsent('[email protected]', 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user