diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-03-31 15:02:39 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-04-18 12:37:05 +0300 |
commit | 7550043371db98433a2eecb0f0baa9a0640a52c7 (patch) | |
tree | b7552fb2ffe173a79b7547250b14ebfa660ba588 /tests | |
parent | 73ef2f3e868fce6ce0be46186136f49f2a96aea8 (diff) |
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 d48826ff5c5..a3a8e2fa173 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 3a08cd9acf2..d568ff3439e 100644 --- a/tests/lib/Mail/MailerTest.php +++ b/tests/lib/Mail/MailerTest.php @@ -15,6 +15,7 @@ use OCP\IConfig; use OCP\IL10N; use OCP\ILogger; use OCP\IURLGenerator; +use OCP\L10N\IFactory; use Test\TestCase; class MailerTest extends TestCase { @@ -44,7 +45,8 @@ class MailerTest extends TestCase { $this->logger, $this->defaults, $this->urlGenerator, - $this->l10n + $this->l10n, + $this->createMock(IFactory::class) ); } @@ -126,7 +128,7 @@ class MailerTest extends TestCase { $this->assertInstanceOf('\OC\Mail\Message', $this->mailer->createMessage()); } - + public function testSendInvalidMailException() { $this->expectException(\Exception::class); |