From fc7a4147c0bd24400ca120ba08ae0f85738edca8 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 3 Feb 2020 09:44:59 +0100 Subject: [PATCH 1/2] Use the l10n from settings Fixes #19261 Signed-off-by: Roeland Jago Douma --- apps/settings/lib/Settings/Admin/Sharing.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/settings/lib/Settings/Admin/Sharing.php b/apps/settings/lib/Settings/Admin/Sharing.php index 591d6a64b8b89..4943ac3b6e4b1 100644 --- a/apps/settings/lib/Settings/Admin/Sharing.php +++ b/apps/settings/lib/Settings/Admin/Sharing.php @@ -52,9 +52,9 @@ class Sharing implements ISettings { /** * @param IConfig $config */ - public function __construct(IConfig $config, IFactory $l, IManager $shareManager) { + public function __construct(IConfig $config, IL10N $l, IManager $shareManager) { $this->config = $config; - $this->l = $l->get('lib'); + $this->l = $l; $this->shareManager = $shareManager; } From dea12135892912cb5d207ff321ec98a507aae45c Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Mon, 3 Feb 2020 10:31:23 +0100 Subject: [PATCH 2/2] Update test to pass l10n instead of factory Signed-off-by: Daniel Kesselberg --- apps/settings/tests/Settings/Admin/SharingTest.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php index 6bfca5bbc0411..b1accfa72f8b0 100644 --- a/apps/settings/tests/Settings/Admin/SharingTest.php +++ b/apps/settings/tests/Settings/Admin/SharingTest.php @@ -33,7 +33,6 @@ use OCP\Constants; use OCP\IConfig; use OCP\IL10N; -use OCP\L10N\IFactory; use OCP\Share\IManager; use Test\TestCase; @@ -52,15 +51,11 @@ protected function setUp(): void { $this->config = $this->getMockBuilder(IConfig::class)->getMock(); $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); - $l10Factory = $this->createMock(IFactory::class); - $l10Factory->method('get') - ->willReturn($this->l10n); - $this->shareManager = $this->getMockBuilder(IManager::class)->getMock(); $this->admin = new Sharing( $this->config, - $l10Factory, + $this->l10n, $this->shareManager ); }