diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/emails/new-account-email-custom-text-alternative.txt | 11 | ||||
-rw-r--r-- | tests/lib/Mail/EMailTemplateTest.php | 42 |
2 files changed, 53 insertions, 0 deletions
diff --git a/tests/data/emails/new-account-email-custom-text-alternative.txt b/tests/data/emails/new-account-email-custom-text-alternative.txt new file mode 100644 index 00000000000..bcbc6632175 --- /dev/null +++ b/tests/data/emails/new-account-email-custom-text-alternative.txt @@ -0,0 +1,11 @@ +Welcome aboard - text + +You have now an Nextcloud account, you can add, protect, and share your data. - text + +Your username is: abc + +Set your password - text: https://example.org/resetPassword/123 +Install Client - text: https://nextcloud.com/install/#install-clients + +-- +TestCloud - A safe home for your data diff --git a/tests/lib/Mail/EMailTemplateTest.php b/tests/lib/Mail/EMailTemplateTest.php index ab90dc4aa07..9f80dad642a 100644 --- a/tests/lib/Mail/EMailTemplateTest.php +++ b/tests/lib/Mail/EMailTemplateTest.php @@ -126,4 +126,46 @@ class EMailTemplateTest extends TestCase { } + + public function testEMailTemplateAlternativePlainTexts() { + $this->defaults + ->expects($this->any()) + ->method('getColorPrimary') + ->willReturn('#0082c9'); + $this->defaults + ->expects($this->any()) + ->method('getName') + ->willReturn('TestCloud'); + $this->defaults + ->expects($this->any()) + ->method('getSlogan') + ->willReturn('A safe home for your data'); + $this->defaults + ->expects($this->any()) + ->method('getLogo') + ->willReturn('/img/logo-mail-header.png'); + $this->urlGenerator + ->expects($this->once()) + ->method('getAbsoluteURL') + ->with('/img/logo-mail-header.png') + ->willReturn('https://example.org/img/logo-mail-header.png'); + + $this->emailTemplate->addHeader(); + $this->emailTemplate->addHeading('Welcome aboard', 'Welcome aboard - text'); + $this->emailTemplate->addBodyText('You have now an Nextcloud account, you can add, protect, and share your data.', 'You have now an Nextcloud account, you can add, protect, and share your data. - text'); + $this->emailTemplate->addBodyText('Your username is: abc'); + $this->emailTemplate->addBodyButtonGroup( + 'Set your password', 'https://example.org/resetPassword/123', + 'Install Client', 'https://nextcloud.com/install/#install-clients', + 'Set your password - text', 'Install Client - text' + ); + $this->emailTemplate->addFooter(); + + $expectedHTML = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email-custom.html'); + $this->assertSame($expectedHTML, $this->emailTemplate->renderHTML()); + $expectedTXT = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email-custom-text-alternative.txt'); + $this->assertSame($expectedTXT, $this->emailTemplate->renderText()); + } + + } |