feat: copy the house managers of the selected houses on assignment mailings
This commit is contained in:
1 parent
2c51ddf86f
commit
f22d1f1199
17 files changed
+293
-24
No files matched your search
@@ -53,7 +53,7 @@ class FeedbackReminderServiceTest extends TestCase
|
||||
{
|
||||
$houseManager = $this->houseManager('[email protected]', ['DKI']);
|
||||
|
||||
$this->userRepository->method('findHouseManagersToRemind')->willReturn([$houseManager]);
|
||||
$this->userRepository->method('findActiveHouseManagers')->willReturn([$houseManager]);
|
||||
$this->destinationRepository
|
||||
->expects($this->once())
|
||||
->method('findPendingForHouseManager')
|
||||
@@ -66,7 +66,7 @@ class FeedbackReminderServiceTest extends TestCase
|
||||
|
||||
public function testMutedHouseManagersAndThoseWithoutHotelCodesAreSkipped(): void
|
||||
{
|
||||
$this->userRepository->method('findHouseManagersToRemind')->willReturn([
|
||||
$this->userRepository->method('findActiveHouseManagers')->willReturn([
|
||||
$this->houseManager('[email protected]', ['DKI'])->setMuteNotifications(true),
|
||||
$this->houseManager('[email protected]', []),
|
||||
]);
|
||||
@@ -83,7 +83,7 @@ class FeedbackReminderServiceTest extends TestCase
|
||||
*/
|
||||
public function testNoMailOnANightNothingIsDue(): void
|
||||
{
|
||||
$this->userRepository->method('findHouseManagersToRemind')->willReturn([$this->houseManager('[email protected]', ['DKI'])]);
|
||||
$this->userRepository->method('findActiveHouseManagers')->willReturn([$this->houseManager('[email protected]', ['DKI'])]);
|
||||
$this->destinationRepository->method('findPendingForHouseManager')->willReturn([$this->row($this->travel(10))]);
|
||||
$this->mailer->expects($this->never())->method('createAndSendEmail');
|
||||
|
||||
@@ -98,7 +98,7 @@ class FeedbackReminderServiceTest extends TestCase
|
||||
$due = $this->travel(14);
|
||||
$quiet = $this->travel(10);
|
||||
|
||||
$this->userRepository->method('findHouseManagersToRemind')->willReturn([$this->houseManager('[email protected]', ['DKI'])]);
|
||||
$this->userRepository->method('findActiveHouseManagers')->willReturn([$this->houseManager('[email protected]', ['DKI'])]);
|
||||
$this->destinationRepository->method('findPendingForHouseManager')->willReturn([$this->row($quiet), $this->row($due)]);
|
||||
$this->mailer
|
||||
->expects($this->once())
|
||||
@@ -124,7 +124,7 @@ class FeedbackReminderServiceTest extends TestCase
|
||||
$untouched = $this->travel(3); // ended 2026-11-17
|
||||
$submitted = $this->travel(1); // ended 2026-11-19
|
||||
|
||||
$this->userRepository->method('findHouseManagersToRemind')->willReturn([$this->houseManager('[email protected]', ['DKI'])]);
|
||||
$this->userRepository->method('findActiveHouseManagers')->willReturn([$this->houseManager('[email protected]', ['DKI'])]);
|
||||
$this->destinationRepository->method('findPendingForHouseManager')->willReturn([
|
||||
$this->row($beforeGoLive, null, 2),
|
||||
$this->row($draft, 'draft', 0),
|
||||
|
||||
@@ -338,6 +338,52 @@ class TeamerMailingServiceTest extends TestCase
|
||||
$this->assertSame(['[email protected]', '[email protected]'], $replyTo);
|
||||
}
|
||||
|
||||
public function testSendMailingPutsEachRecipientsCcOnTheirMailOnly(): void
|
||||
{
|
||||
$cc = [];
|
||||
$this->mailer
|
||||
->expects($this->exactly(2))
|
||||
->method('createAndSendEmail')
|
||||
->willReturnCallback(function (array $context, array $options) use (&$cc): void {
|
||||
$cc[$options['to']] = $options['cc'];
|
||||
})
|
||||
;
|
||||
|
||||
$anna = $this->createRecipient('Anna', 'Berg', '[email protected]');
|
||||
$recipients = (new TeamerMailingRecipientsDto())
|
||||
->addEligible($anna)
|
||||
->addEligible($this->createRecipient('Bea', 'Ohm', '[email protected]'))
|
||||
;
|
||||
|
||||
$this->service->sendMailing(SendTeamerMailing::fromRecipients(
|
||||
'Betreff',
|
||||
'Nachricht',
|
||||
$recipients,
|
||||
cc: [$anna->getId() => ['[email protected]', '[email protected]']]
|
||||
));
|
||||
|
||||
$this->assertSame([
|
||||
'[email protected]' => ['[email protected]', '[email protected]'],
|
||||
'[email protected]' => [],
|
||||
], $cc);
|
||||
}
|
||||
|
||||
public function testAMailingQueuedWithoutTheCcSendsNone(): void
|
||||
{
|
||||
$this->mailer
|
||||
->expects($this->once())
|
||||
->method('createAndSendEmail')
|
||||
->willReturnCallback(function (array $context, array $options): void {
|
||||
$this->assertSame([], $options['cc']);
|
||||
})
|
||||
;
|
||||
|
||||
// the snapshot as it was queued before the 'cc' key existed
|
||||
$this->service->sendMailing(new SendTeamerMailing('Betreff', 'Nachricht', [
|
||||
['email' => '[email protected]', 'firstName' => 'Anna', 'lastName' => 'Berg', 'fullName' => 'Anna Berg'],
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* A preview has to stay on the default relay and the default queue, or composing a
|
||||
* mailing would wait on the same worker the mailing itself is queued behind.
|
||||
|
||||
Reference in new issue
Block a user