diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php index ef45f114f44e0..6f07f3dd28706 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php @@ -27,6 +27,9 @@ class EmailProviderTest extends AbstractNotificationProviderTestCase { public const USER_EMAIL = 'frodo@hobb.it'; private IMailer&MockObject $mailer; + /** @var list order of the note and details blocks across all templates */ + private array $blockOrder = []; + protected function setUp(): void { parent::setUp(); @@ -123,6 +126,8 @@ public function testSendWithoutAttendees():void { $vcalendar = $this->getNoAttendeeVCalendar(); $this->provider->send($vcalendar->VEVENT, $this->calendarDisplayName, $principalEmailAddresses, $users); + + $this->assertSame(['details', 'note', 'details', 'note'], $this->blockOrder); } public function testSendWithAttendeesWhenOwnerIsOrganizer(): void { @@ -320,11 +325,17 @@ private function getTemplateMock():IEMailTemplate { ['When', ['weekdayName, datetime - time (UTC)']], ['Where', ['Location 123']], ]; - })); + })) + ->willReturnCallback(function (): void { + $this->blockOrder[] = 'details'; + }); $template->expects($this->once()) ->method('addBodyNote') - ->with('DESCRIPTION 456', 'Description'); + ->with('DESCRIPTION 456', 'Description') + ->willReturnCallback(function (): void { + $this->blockOrder[] = 'note'; + }); $template->expects($this->once()) ->method('addFooter') diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php index 17d45f978c671..3853239c799a2 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php @@ -2529,6 +2529,31 @@ private static function rowsOf(EMailDetails $details): array { ); } + public function testAddEventDetailsPutsDescriptionAfterCard(): void { + $this->mockDetailsL10n(); + $this->appConfig->method('getValueBool')->willReturn(false); + $template = $this->createMock(IEMailTemplate::class); + $order = []; + $template->method('addBodyNote')->willReturnCallback(function (string $text, string $label) use (&$order): void { + $order[] = 'note:' . $label; + }); + $template->method('addBodyDetails')->willReturnCallback(function () use (&$order): void { + $order[] = 'details'; + }); + + $this->service->addEventDetails($template, $this->createDetailsEvent(), [ + 'meeting_title' => 'Title', + 'meeting_when' => 'Monday', + 'meeting_location' => '', + 'meeting_url' => '', + 'meeting_description' => 'New description', + 'meeting_description_previous' => 'Old description', + 'meeting_occurring' => '', + ]); + + $this->assertSame(['details', 'note:Description', 'note:Previous description'], $order); + } + public function testAddEventDetails(): void { $this->mockDetailsL10n(); $this->appConfig->method('getValueBool')->willReturn(false); diff --git a/apps/settings/tests/HooksTest.php b/apps/settings/tests/HooksTest.php index 92d417a130072..766e39c83cdd3 100644 --- a/apps/settings/tests/HooksTest.php +++ b/apps/settings/tests/HooksTest.php @@ -91,6 +91,7 @@ public function testPasswordChangedMail(): void { public function testEmailChangedMail(): void { $this->user->method('getEMailAddress')->willReturn('new@example.com'); + $order = []; $this->template->expects($this->once())->method('addBodyText') ->with('Your email address on https://cloud.example.com/ was changed.'); @@ -102,12 +103,20 @@ public function testEmailChangedMail(): void { ['Previous email address', [[EMailDetailsRow::PART_TEXT, 'old@example.com']]], ['New email address', [[EMailDetailsRow::PART_TEXT, 'new@example.com']]], ], - ])); + ])) + ->willReturnCallback(function () use (&$order): void { + $order[] = 'details'; + }); $this->template->expects($this->once())->method('addBodyNote') - ->with('If you did not request this, please contact an administrator.', '', IEMailTemplate::NOTE_WARNING); + ->with('If you did not request this, please contact an administrator.', '', IEMailTemplate::NOTE_WARNING) + ->willReturnCallback(function () use (&$order): void { + $order[] = 'note'; + }); $this->mailer->expects($this->once())->method('send'); $this->hooks->handle(new UserChangedEvent($this->user, 'eMailAddress', 'new@example.com', 'old@example.com')); + + $this->assertSame(['details', 'note'], $order); } public function testEmailRemovedMail(): void { diff --git a/apps/settings/tests/Mailer/NewUserMailHelperTest.php b/apps/settings/tests/Mailer/NewUserMailHelperTest.php index d21826a4e2bcd..bcd3882e8d96d 100644 --- a/apps/settings/tests/Mailer/NewUserMailHelperTest.php +++ b/apps/settings/tests/Mailer/NewUserMailHelperTest.php @@ -160,6 +160,7 @@ public function testGenerateTemplateWithPasswordResetToken(): void { :root{color-scheme:light dark;supported-color-schemes:light dark} body{margin:0;padding:0;width:100%!important} @media only screen and (max-width:640px){ + .nc-page-pad{padding:0!important} .nc-card{border-radius:0!important;width:100%!important} .nc-pad{padding-left:20px!important;padding-right:20px!important} .nc-button{display:block!important;margin:0 0 12px 0!important} @@ -181,7 +182,7 @@ public function testGenerateTemplateWithPasswordResetToken(): void { -