summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-05-21 22:25:11 +0200
committerBackportbot <backportbot-noreply@rullzer.com>2019-05-21 22:52:06 +0000
commita68495b443dd0183fb8e6c3a86dda9862d7648a1 (patch)
tree6078d33487fb2689103145f8643d9c8d94d8e4b5 /tests
parentdb6656b6e9a0954a08fd8aa805923b13b78ae398 (diff)
downloadnextcloud-server-a68495b443dd0183fb8e6c3a86dda9862d7648a1.tar.gz
nextcloud-server-a68495b443dd0183fb8e6c3a86dda9862d7648a1.zip
Fix l10n for SettingsManager by injecting the l10n factory
Fixes #10832 Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Settings/ManagerTest.php31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php
index b82fb5bc3ca..7372cae811b 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -33,6 +33,7 @@ use OCP\IL10N;
use OCP\ILogger;
use OCP\IServerContainer;
use OCP\IURLGenerator;
+use OCP\L10N\IFactory;
use Test\TestCase;
class ManagerTest extends TestCase {
@@ -43,6 +44,8 @@ class ManagerTest extends TestCase {
private $logger;
/** @var IDBConnection|\PHPUnit_Framework_MockObject_MockObject */
private $l10n;
+ /** @var IFactory|\PHPUnit_Framework_MockObject_MockObject */
+ private $l10nFactory;
/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
private $url;
/** @var IServerContainer|\PHPUnit_Framework_MockObject_MockObject */
@@ -53,18 +56,24 @@ class ManagerTest extends TestCase {
$this->logger = $this->createMock(ILogger::class);
$this->l10n = $this->createMock(IL10N::class);
+ $this->l10nFactory = $this->createMock(IFactory::class);
$this->url = $this->createMock(IURLGenerator::class);
$this->container = $this->createMock(IServerContainer::class);
$this->manager = new Manager(
$this->logger,
- $this->l10n,
+ $this->l10nFactory,
$this->url,
$this->container
);
}
public function testGetAdminSections() {
+ $this->l10nFactory
+ ->expects($this->once())
+ ->method('get')
+ ->with('lib')
+ ->willReturn($this->l10n);
$this->l10n
->expects($this->any())
->method('t')
@@ -95,6 +104,11 @@ class ManagerTest extends TestCase {
}
public function testGetPersonalSections() {
+ $this->l10nFactory
+ ->expects($this->once())
+ ->method('get')
+ ->with('lib')
+ ->willReturn($this->l10n);
$this->l10n
->expects($this->any())
->method('t')
@@ -119,6 +133,11 @@ class ManagerTest extends TestCase {
}
public function testGetAdminSectionsEmptySection() {
+ $this->l10nFactory
+ ->expects($this->once())
+ ->method('get')
+ ->with('lib')
+ ->willReturn($this->l10n);
$this->l10n
->expects($this->any())
->method('t')
@@ -146,6 +165,11 @@ class ManagerTest extends TestCase {
}
public function testGetPersonalSectionsEmptySection() {
+ $this->l10nFactory
+ ->expects($this->once())
+ ->method('get')
+ ->with('lib')
+ ->willReturn($this->l10n);
$this->l10n
->expects($this->any())
->method('t')
@@ -201,6 +225,11 @@ class ManagerTest extends TestCase {
}
public function testSameSectionAsPersonalAndAdmin() {
+ $this->l10nFactory
+ ->expects($this->once())
+ ->method('get')
+ ->with('lib')
+ ->willReturn($this->l10n);
$this->l10n
->expects($this->any())
->method('t')