diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-04-12 01:24:58 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-04-12 23:19:53 +0300 |
commit | 1f962f91154b04c5ec49df14a3e0aa2f4905e1c6 (patch) | |
tree | b14c931198014bfc26fdbca420889fb26dc5eb91 /tests/Core | |
parent | b3b24172e48d11e1247db84bfec5b6650883a7a4 (diff) |
Update email template for lost password email
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
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())); |