summaryrefslogtreecommitdiffstats
path: root/tests/lib/Mail/EMailTemplateTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Mail/EMailTemplateTest.php')
-rw-r--r--tests/lib/Mail/EMailTemplateTest.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/lib/Mail/EMailTemplateTest.php b/tests/lib/Mail/EMailTemplateTest.php
index 9f80dad642a..f9e1ecf29ca 100644
--- a/tests/lib/Mail/EMailTemplateTest.php
+++ b/tests/lib/Mail/EMailTemplateTest.php
@@ -62,6 +62,10 @@ class EMailTemplateTest extends TestCase {
->expects($this->any())
->method('getLogo')
->willReturn('/img/logo-mail-header.png');
+ $this->defaults
+ ->expects($this->any())
+ ->method('getName')
+ ->willReturn('TestCloud');
$this->urlGenerator
->expects($this->once())
->method('getAbsoluteURL')
@@ -125,6 +129,44 @@ class EMailTemplateTest extends TestCase {
$this->assertSame($expectedTXT, $this->emailTemplate->renderText());
}
+ public function testEMailTemplateSingleButton() {
+ $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');
+ $this->emailTemplate->addBodyText('You have now an Nextcloud account, you can add, protect, and share your data.');
+ $this->emailTemplate->addBodyText('Your username is: abc');
+ $this->emailTemplate->addBodyButton(
+ 'Set your password', 'https://example.org/resetPassword/123'
+ );
+ $this->emailTemplate->addFooter();
+
+ $expectedHTML = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email-single-button.html');
+ $this->assertSame($expectedHTML, $this->emailTemplate->renderHTML());
+ $expectedTXT = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email-single-button.txt');
+ $this->assertSame($expectedTXT, $this->emailTemplate->renderText());
+ }
+
public function testEMailTemplateAlternativePlainTexts() {