diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-04-05 17:42:14 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-04-05 17:42:14 +0200 |
commit | 8d5165e8dc40289b5d523523c4140f780b2fe293 (patch) | |
tree | b4d15f2bc67e16c94d7cdfdb893a773b415d2738 /tests/lib/L10N | |
parent | 426c0341ffff262f58d1b7f031de4f0c53c8bec5 (diff) | |
download | nextcloud-server-8d5165e8dc40289b5d523523c4140f780b2fe293.tar.gz nextcloud-server-8d5165e8dc40289b5d523523c4140f780b2fe293.zip |
Adapt tests to config value typing
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'tests/lib/L10N')
-rw-r--r-- | tests/lib/L10N/FactoryTest.php | 30 | ||||
-rw-r--r-- | tests/lib/L10N/LanguageIteratorTest.php | 4 |
2 files changed, 17 insertions, 17 deletions
diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php index 0b536971e90..2db1e0302e8 100644 --- a/tests/lib/L10N/FactoryTest.php +++ b/tests/lib/L10N/FactoryTest.php @@ -47,6 +47,12 @@ class FactoryTest extends TestCase { $this->cacheFactory = $this->createMock(ICacheFactory::class); $this->serverRoot = \OC::$SERVERROOT; + + $this->config + ->method('getSystemValueBool') + ->willReturnMap([ + ['installed', false, true], + ]); } /** @@ -121,14 +127,12 @@ class FactoryTest extends TestCase { true, ); $this->config - ->expects($this->exactly(2)) + ->expects($this->exactly(1)) ->method('getSystemValue') ->withConsecutive( ['force_language', false], - ['installed', false], )->willReturnOnConsecutiveCalls( false, - true, ); $user = $this->getMockBuilder(IUser::class) ->getMock(); @@ -159,11 +163,10 @@ class FactoryTest extends TestCase { ['MyApp', 'es', true], ]); $this->config - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getSystemValue') ->willReturnMap([ ['force_language', false, false], - ['installed', false, true], ['default_language', false, 'es'] ]); $user = $this->getMockBuilder(IUser::class) @@ -195,11 +198,10 @@ class FactoryTest extends TestCase { ['MyApp', 'es', false], ]); $this->config - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getSystemValue') ->willReturnMap([ ['force_language', false, false], - ['installed', false, true], ['default_language', false, 'es'] ]); $user = $this->getMockBuilder(IUser::class) @@ -234,11 +236,10 @@ class FactoryTest extends TestCase { ['MyApp', 'es', false], ]); $this->config - ->expects($this->exactly(3)) + ->expects($this->exactly(2)) ->method('getSystemValue') ->willReturnMap([ ['force_language', false, false], - ['installed', false, true], ['default_language', false, 'es'] ]); $user = $this->getMockBuilder(IUser::class) @@ -319,7 +320,7 @@ class FactoryTest extends TestCase { ->willReturn($this->serverRoot . '/apps/files/l10n/'); $this->config ->expects(self::once()) - ->method('getSystemValue') + ->method('getSystemValueString') ->with('theme') ->willReturn('abc'); @@ -474,9 +475,7 @@ class FactoryTest extends TestCase { $this->config->expects(self::any()) ->method('getSystemValue') ->willReturnCallback(function ($var, $default) use ($defaultLang) { - if ($var === 'installed') { - return true; - } elseif ($var === 'default_language') { + if ($var === 'default_language') { return $defaultLang; } else { return $default; @@ -562,12 +561,11 @@ class FactoryTest extends TestCase { public function testFindGenericLanguageByUserLanguage(): void { $factory = $this->getFactory(); - $this->config->expects(self::exactly(3)) + $this->config->expects(self::exactly(2)) ->method('getSystemValue') ->willReturnMap([ ['force_language', false, false,], ['default_language', false, false,], - ['installed', false, true], ]); $user = $this->createMock(IUser::class); $this->userSession->expects(self::once()) @@ -590,7 +588,6 @@ class FactoryTest extends TestCase { ->willReturnMap([ ['force_language', false, false,], ['default_language', false, false,], - ['installed', false, true], ]); $user = $this->createMock(IUser::class); $this->userSession->expects(self::once()) @@ -621,7 +618,6 @@ class FactoryTest extends TestCase { ->willReturnMap([ ['force_language', false, false,], ['default_language', false, false,], - ['installed', false, true], ]); $user = $this->createMock(IUser::class); $this->userSession->expects(self::once()) diff --git a/tests/lib/L10N/LanguageIteratorTest.php b/tests/lib/L10N/LanguageIteratorTest.php index bbbbb145c75..1d5335cebaa 100644 --- a/tests/lib/L10N/LanguageIteratorTest.php +++ b/tests/lib/L10N/LanguageIteratorTest.php @@ -82,6 +82,10 @@ class LanguageIteratorTest extends TestCase { ->method('getSystemValue') ->willReturnMap([ ['force_language', false, $forcedLang], + ]); + $this->config->expects($this->any()) + ->method('getSystemValueString') + ->willReturnMap([ ['default_language', 'en', $sysLang], ]); $this->config->expects($this->any()) |