From bb4dedb0156727ebd88a3f922fedc78436d7b701 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 31 Mar 2020 14:02:39 +0200 Subject: Provide the proper language to the mailer Else we can't properly translate the footer in the recipients e-mail language. Signed-off-by: Roeland Jago Douma --- tests/lib/Mail/EMailTemplateTest.php | 9 +++++++-- tests/lib/Mail/MailerTest.php | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/lib/Mail/EMailTemplateTest.php b/tests/lib/Mail/EMailTemplateTest.php index 4b4ff616d4e..a900b1fe47d 100644 --- a/tests/lib/Mail/EMailTemplateTest.php +++ b/tests/lib/Mail/EMailTemplateTest.php @@ -27,6 +27,7 @@ use OC\Mail\EMailTemplate; use OCP\Defaults; use OCP\IL10N; use OCP\IURLGenerator; +use OCP\L10N\IFactory; use Test\TestCase; class EMailTemplateTest extends TestCase { @@ -34,7 +35,7 @@ class EMailTemplateTest extends TestCase { private $defaults; /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ private $urlGenerator; - /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */ + /** @var IFactory|\PHPUnit_Framework_MockObject_MockObject */ private $l10n; /** @var EMailTemplate */ private $emailTemplate; @@ -44,7 +45,11 @@ class EMailTemplateTest extends TestCase { $this->defaults = $this->createMock(Defaults::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); - $this->l10n = $this->createMock(IL10N::class); + $this->l10n = $this->createMock(IFactory::class); + + $this->l10n->method('get') + ->with('lib', '') + ->willReturn($this->createMock(IL10N::class)); $this->emailTemplate = new EMailTemplate( $this->defaults, diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php index 996048452bb..9e7f6a4134c 100644 --- a/tests/lib/Mail/MailerTest.php +++ b/tests/lib/Mail/MailerTest.php @@ -20,6 +20,7 @@ use OCP\IConfig; use OCP\IL10N; use OCP\ILogger; use OCP\IURLGenerator; +use OCP\L10N\IFactory; use OCP\Mail\Events\BeforeMessageSent; use Test\TestCase; use Swift_SwiftException; @@ -56,7 +57,8 @@ class MailerTest extends TestCase { $this->defaults, $this->urlGenerator, $this->l10n, - $this->dispatcher + $this->dispatcher, + $this->createMock(IFactory::class) ); } @@ -153,7 +155,7 @@ class MailerTest extends TestCase { $this->assertInstanceOf('\OC\Mail\Message', $this->mailer->createMessage()); } - + public function testSendInvalidMailException() { $this->expectException(\Exception::class); -- cgit v1.2.3