fix: keep post-booking newsletter failures out of the booking flow
This commit is contained in:
1 parent
876e69e62c
commit
773cd4f847
2 files changed
+54
-12
No files matched your search
@@ -110,6 +110,44 @@ class BookingNewsletterOptInTest extends TestCase
|
||||
self::assertSame(['[email protected]', '[email protected]'], $requestedEmails);
|
||||
}
|
||||
|
||||
public function testAFailingConsentLookupDoesNotEscapeToTheCaller(): void
|
||||
{
|
||||
$companions = $this->createCompanions([
|
||||
'[email protected]',
|
||||
'[email protected]',
|
||||
]);
|
||||
|
||||
$newsletterManager = $this->createMock(NewsletterManager::class);
|
||||
$newsletterManager
|
||||
->method('hasConfirmedOptIn')
|
||||
->willReturnCallback(static function (string $email): bool {
|
||||
if ('[email protected]' === $email) {
|
||||
throw new \RuntimeException('Database gone.');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
$newsletterManager->method('hasPendingConfirmation')->willReturn(false);
|
||||
$newsletterManager
|
||||
->expects(self::once())
|
||||
->method('requestConfirmation')
|
||||
->with('[email protected]');
|
||||
|
||||
$this->createService($newsletterManager)->subscribeCompanions($companions, 'Mia Muster');
|
||||
}
|
||||
|
||||
public function testApplicantOptInFailureDoesNotEscapeToTheCaller(): void
|
||||
{
|
||||
$newsletterManager = $this->createStub(NewsletterManager::class);
|
||||
$newsletterManager
|
||||
->method('requestConfirmation')
|
||||
->willThrowException(new \RuntimeException('Database gone.'));
|
||||
|
||||
$this->createService($newsletterManager)->subscribeApplicant('[email protected]', null);
|
||||
|
||||
$this->expectNotToPerformAssertions();
|
||||
}
|
||||
|
||||
public function testApplicantOptInUsesTheOwnWording(): void
|
||||
{
|
||||
$bookingDto = $this->createBookingDto([['[email protected]', 30]]);
|
||||
|
||||
Reference in new issue
Block a user