diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-04-12 10:15:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-12 10:15:06 +0200 |
commit | d127f47801188308f29842db08ca4f57a4d2a328 (patch) | |
tree | 3800db32c9f20ddc8a22ddadecd0f879db4c66d1 /tests | |
parent | feb594e212bc9f73ae5b2a9da5afff753003ae14 (diff) | |
parent | be9a514dffa281af00bbfa54028cd84283f76ef5 (diff) | |
download | nextcloud-server-d127f47801188308f29842db08ca4f57a4d2a328.tar.gz nextcloud-server-d127f47801188308f29842db08ca4f57a4d2a328.zip |
Merge pull request #4310 from nextcloud/allow-plain-text-email
Allow to set text versions for the plain text email
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()); + } + + } |