diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-04-11 17:45:05 -0500 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-04-11 17:50:06 -0500 |
commit | be9a514dffa281af00bbfa54028cd84283f76ef5 (patch) | |
tree | 97fac561e5fa9db984762103fde49c244d9c8897 /tests/lib/Mail/EMailTemplateTest.php | |
parent | 6bd1c50dc32ccc208723ef08af72b8bfe99b58bb (diff) | |
download | nextcloud-server-be9a514dffa281af00bbfa54028cd84283f76ef5.tar.gz nextcloud-server-be9a514dffa281af00bbfa54028cd84283f76ef5.zip |
Allow to set text versions for the plain text email
* allows different texts for HTML and text version of the email
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests/lib/Mail/EMailTemplateTest.php')
-rw-r--r-- | tests/lib/Mail/EMailTemplateTest.php | 42 |
1 files changed, 42 insertions, 0 deletions
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()); + } + + } |