diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-04-13 21:02:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-13 21:02:15 +0300 |
commit | 81d3732bf51590ca3e3b8abc794d9562346862f5 (patch) | |
tree | 0c31d0bd84d07461cb3b439ed256be7f6dc3596c /tests/Core | |
parent | d36751ee38ee3c9994ac6f2e44313b29d893d2f7 (diff) | |
parent | 1f962f91154b04c5ec49df14a3e0aa2f4905e1c6 (diff) |
Merge pull request #4308 from nextcloud/lost-password-email
Update email template for lost password email
Diffstat (limited to 'tests/Core')
-rw-r--r-- | tests/Core/Controller/LostControllerTest.php | 58 |
1 files changed, 52 insertions, 6 deletions
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index c8b8f87e73b..539fe016c8b 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -33,6 +33,7 @@ use OCP\IRequest; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; +use OCP\Mail\IEMailTemplate; use OCP\Mail\IMailer; use OCP\Security\ICrypto; use OCP\Security\ISecureRandom; @@ -314,17 +315,32 @@ class LostControllerTest extends \Test\TestCase { $message ->expects($this->at(2)) ->method('setPlainBody') - ->with('Use the following link to reset your password: https://example.tld/index.php/lostpassword/'); + ->with('text body'); $message ->expects($this->at(3)) + ->method('setHtmlBody') + ->with('HTML body'); + $message + ->expects($this->at(4)) ->method('setFrom') ->with(['lostpassword-noreply@localhost' => null]); + $emailTemplate = $this->createMock(IEMailTemplate::class); + $emailTemplate->expects($this->any()) + ->method('renderHTML') + ->willReturn('HTML body'); + $emailTemplate->expects($this->any()) + ->method('renderText') + ->willReturn('text body'); $this->mailer ->expects($this->at(0)) + ->method('createEMailTemplate') + ->willReturn($emailTemplate); + $this->mailer + ->expects($this->at(1)) ->method('createMessage') ->will($this->returnValue($message)); $this->mailer - ->expects($this->at(1)) + ->expects($this->at(2)) ->method('send') ->with($message); @@ -385,17 +401,32 @@ class LostControllerTest extends \Test\TestCase { $message ->expects($this->at(2)) ->method('setPlainBody') - ->with('Use the following link to reset your password: https://example.tld/index.php/lostpassword/'); + ->with('text body'); $message ->expects($this->at(3)) + ->method('setHtmlBody') + ->with('HTML body'); + $message + ->expects($this->at(4)) ->method('setFrom') ->with(['lostpassword-noreply@localhost' => null]); + $emailTemplate = $this->createMock(IEMailTemplate::class); + $emailTemplate->expects($this->any()) + ->method('renderHTML') + ->willReturn('HTML body'); + $emailTemplate->expects($this->any()) + ->method('renderText') + ->willReturn('text body'); $this->mailer ->expects($this->at(0)) + ->method('createEMailTemplate') + ->willReturn($emailTemplate); + $this->mailer + ->expects($this->at(1)) ->method('createMessage') ->will($this->returnValue($message)); $this->mailer - ->expects($this->at(1)) + ->expects($this->at(2)) ->method('send') ->with($message); @@ -450,17 +481,32 @@ class LostControllerTest extends \Test\TestCase { $message ->expects($this->at(2)) ->method('setPlainBody') - ->with('Use the following link to reset your password: https://example.tld/index.php/lostpassword/'); + ->with('text body'); $message ->expects($this->at(3)) + ->method('setHtmlBody') + ->with('HTML body'); + $message + ->expects($this->at(4)) ->method('setFrom') ->with(['lostpassword-noreply@localhost' => null]); + $emailTemplate = $this->createMock(IEMailTemplate::class); + $emailTemplate->expects($this->any()) + ->method('renderHTML') + ->willReturn('HTML body'); + $emailTemplate->expects($this->any()) + ->method('renderText') + ->willReturn('text body'); $this->mailer ->expects($this->at(0)) + ->method('createEMailTemplate') + ->willReturn($emailTemplate); + $this->mailer + ->expects($this->at(1)) ->method('createMessage') ->will($this->returnValue($message)); $this->mailer - ->expects($this->at(1)) + ->expects($this->at(2)) ->method('send') ->with($message) ->will($this->throwException(new \Exception())); |