From 0560e6991323c156e548792c5fb1f82791868d90 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 6 Apr 2017 13:20:47 -0500 Subject: New layout for welcome email * thanks to @espina2 for make this nice design * the button says "Set password" if the admin didn't specified a password Signed-off-by: Morris Jobke --- tests/Settings/Controller/UsersControllerTest.php | 79 ++++++++++++----------- 1 file changed, 41 insertions(+), 38 deletions(-) (limited to 'tests/Settings') diff --git a/tests/Settings/Controller/UsersControllerTest.php b/tests/Settings/Controller/UsersControllerTest.php index 3cdde1b2d27..2ed298df2dc 100644 --- a/tests/Settings/Controller/UsersControllerTest.php +++ b/tests/Settings/Controller/UsersControllerTest.php @@ -12,6 +12,7 @@ namespace Tests\Settings\Controller; use OC\Accounts\AccountManager; use OC\Group\Manager; +use OC\Mail\EMailTemplate; use OC\Settings\Controller\UsersController; use OCP\App\IAppManager; use OCP\AppFramework\Http; @@ -1427,32 +1428,33 @@ class UsersControllerTest extends \Test\TestCase { ->expects($this->at(1)) ->method('setSubject') ->with('Your account was created'); - $htmlBody = new Http\TemplateResponse( - 'settings', - 'email.new_user', - [ - 'username' => 'foo', - 'url' => '', - ], - 'blank' + + $emailTemplate = new EMailTemplate($this->defaults); + + $emailTemplate->addHeader('https://example.org/img/logo-mail-header.png'); + + $emailTemplate->addHeading('Welcome aboard'); + $emailTemplate->addBodyText('You have now an Nextcloud account, you can add, protect, and share your data.'); + $emailTemplate->addBodyText('Your username is: foo'); + + + $emailTemplate->addBodyButtonGroup( + 'Go to Nextcloud', 'https://example.org/resetPassword/123', + 'Install Client', 'https://nextcloud.com/install/#install-clients' + ); + + $emailTemplate->addFooter( + 'https://example.org/img/logo-mail-footer.png', + 'TestCloud - A safe home for your data
This is an automatically generated email, please do not reply.' ); $message ->expects($this->at(2)) ->method('setHtmlBody') - ->with($htmlBody->render()); - $plainBody = new Http\TemplateResponse( - 'settings', - 'email.new_user_plain_text', - [ - 'username' => 'foo', - 'url' => '', - ], - 'blank' - ); + ->with($emailTemplate->renderHTML()); $message ->expects($this->at(3)) ->method('setPlainBody') - ->with($plainBody->render()); + ->with($emailTemplate->renderText()); $message ->expects($this->at(4)) ->method('setFrom') @@ -2325,32 +2327,33 @@ class UsersControllerTest extends \Test\TestCase { ->expects($this->at(1)) ->method('setSubject') ->with('Your account was created'); - $htmlBody = new Http\TemplateResponse( - 'settings', - 'email.new_user', - [ - 'username' => 'foo', - 'url' => 'link-with-my-token', - ], - 'blank' + + $emailTemplate = new EMailTemplate($this->defaults); + + $emailTemplate->addHeader('https://example.org/img/logo-mail-header.png'); + + $emailTemplate->addHeading('Welcome aboard'); + $emailTemplate->addBodyText('You have now an Nextcloud account, you can add, protect, and share your data.'); + $emailTemplate->addBodyText('Your username is: foo'); + + + $emailTemplate->addBodyButtonGroup( + 'Go to Nextcloud', 'https://example.org/resetPassword/123', + 'Install Client', 'https://nextcloud.com/install/#install-clients' + ); + + $emailTemplate->addFooter( + 'https://example.org/img/logo-mail-footer.png', + 'TestCloud - A safe home for your data
This is an automatically generated email, please do not reply.' ); $message ->expects($this->at(2)) ->method('setHtmlBody') - ->with($htmlBody->render()); - $plainBody = new Http\TemplateResponse( - 'settings', - 'email.new_user_plain_text', - [ - 'username' => 'foo', - 'url' => 'link-with-my-token', - ], - 'blank' - ); + ->with($emailTemplate->renderHTML()); $message ->expects($this->at(3)) ->method('setPlainBody') - ->with($plainBody->render()); + ->with($emailTemplate->renderText()); $message ->expects($this->at(4)) ->method('setFrom') -- cgit v1.2.3