diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-03-31 14:02:39 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-04-16 09:04:13 +0200 |
commit | bb4dedb0156727ebd88a3f922fedc78436d7b701 (patch) | |
tree | e1975ad11d4d3903c6c1520f93a1a398f80ac1b6 /tests | |
parent | 078ac97939747eec246ed105830d4643b81d994c (diff) | |
download | nextcloud-server-bb4dedb0156727ebd88a3f922fedc78436d7b701.tar.gz nextcloud-server-bb4dedb0156727ebd88a3f922fedc78436d7b701.zip |
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 <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Mail/EMailTemplateTest.php | 9 | ||||
-rw-r--r-- | tests/lib/Mail/MailerTest.php | 6 |
2 files changed, 11 insertions, 4 deletions
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); |