diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-08-29 16:36:40 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-08-29 16:36:40 +0200 |
commit | 6f80fe6ada68cee35e714568afeb614238fbc241 (patch) | |
tree | eec7e8eb3742ec0e6b0463c290cb0cf146affca7 /tests/lib/L10N | |
parent | 791e0214556c353d9c3ac9b2c54e465588c6af67 (diff) | |
download | nextcloud-server-6f80fe6ada68cee35e714568afeb614238fbc241.tar.gz nextcloud-server-6f80fe6ada68cee35e714568afeb614238fbc241.zip |
Remove deprecated at matcher from tests/lib
Only 15 warnings left in there
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'tests/lib/L10N')
-rw-r--r-- | tests/lib/L10N/FactoryTest.php | 118 |
1 files changed, 41 insertions, 77 deletions
diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php index faf9dff48cc..4e01602a4f7 100644 --- a/tests/lib/L10N/FactoryTest.php +++ b/tests/lib/L10N/FactoryTest.php @@ -146,20 +146,21 @@ class FactoryTest extends TestCase { public function testFindLanguageWithNotExistingRequestLanguageAndNotExistingStoredUserLanguage(): void { $factory = $this->getFactory(['languageExists'], true); $this->invokePrivate($factory, 'requestLanguage', ['de']); - $factory->expects(self::at(0)) - ->method('languageExists') - ->with('MyApp', 'de') - ->willReturn(false); + $factory->expects($this->exactly(3)) + ->method('languageExists') + ->willReturnMap([ + ['MyApp', 'de', false], + ['MyApp', 'jp', false], + ['MyApp', 'es', true], + ]); $this->config - ->expects(self::at(0)) + ->expects($this->exactly(3)) ->method('getSystemValue') - ->with('force_language', false) - ->willReturn(false); - $this->config - ->expects(self::at(1)) - ->method('getSystemValue') - ->with('installed', false) - ->willReturn(true); + ->willReturnMap([ + ['force_language', false, false], + ['installed', false, true], + ['default_language', false, 'es'] + ]); $user = $this->getMockBuilder(IUser::class) ->getMock(); $user->expects(self::once()) @@ -174,19 +175,6 @@ class FactoryTest extends TestCase { ->method('getUserValue') ->with('MyUserUid', 'core', 'lang', null) ->willReturn('jp'); - $factory->expects(self::at(1)) - ->method('languageExists') - ->with('MyApp', 'jp') - ->willReturn(false); - $this->config - ->expects(self::at(3)) - ->method('getSystemValue') - ->with('default_language', false) - ->willReturn('es'); - $factory->expects(self::at(2)) - ->method('languageExists') - ->with('MyApp', 'es') - ->willReturn(true); self::assertSame('es', $factory->findLanguage('MyApp')); } @@ -194,20 +182,21 @@ class FactoryTest extends TestCase { public function testFindLanguageWithNotExistingRequestLanguageAndNotExistingStoredUserLanguageAndNotExistingDefault(): void { $factory = $this->getFactory(['languageExists'], true); $this->invokePrivate($factory, 'requestLanguage', ['de']); - $factory->expects(self::at(0)) - ->method('languageExists') - ->with('MyApp', 'de') - ->willReturn(false); + $factory->expects($this->exactly(3)) + ->method('languageExists') + ->willReturnMap([ + ['MyApp', 'de', false], + ['MyApp', 'jp', false], + ['MyApp', 'es', false], + ]); $this->config - ->expects(self::at(0)) + ->expects($this->exactly(3)) ->method('getSystemValue') - ->with('force_language', false) - ->willReturn(false); - $this->config - ->expects(self::at(1)) - ->method('getSystemValue') - ->with('installed', false) - ->willReturn(true); + ->willReturnMap([ + ['force_language', false, false], + ['installed', false, true], + ['default_language', false, 'es'] + ]); $user = $this->getMockBuilder(IUser::class) ->getMock(); $user->expects(self::once()) @@ -222,19 +211,6 @@ class FactoryTest extends TestCase { ->method('getUserValue') ->with('MyUserUid', 'core', 'lang', null) ->willReturn('jp'); - $factory->expects(self::at(1)) - ->method('languageExists') - ->with('MyApp', 'jp') - ->willReturn(false); - $this->config - ->expects(self::at(3)) - ->method('getSystemValue') - ->with('default_language', false) - ->willReturn('es'); - $factory->expects(self::at(2)) - ->method('languageExists') - ->with('MyApp', 'es') - ->willReturn(false); $this->config ->expects(self::never()) ->method('setUserValue'); @@ -245,20 +221,21 @@ class FactoryTest extends TestCase { public function testFindLanguageWithNotExistingRequestLanguageAndNotExistingStoredUserLanguageAndNotExistingDefaultAndNoAppInScope(): void { $factory = $this->getFactory(['languageExists'], true); $this->invokePrivate($factory, 'requestLanguage', ['de']); - $factory->expects(self::at(0)) - ->method('languageExists') - ->with('MyApp', 'de') - ->willReturn(false); + $factory->expects($this->exactly(3)) + ->method('languageExists') + ->willReturnMap([ + ['MyApp', 'de', false], + ['MyApp', 'jp', false], + ['MyApp', 'es', false], + ]); $this->config - ->expects(self::at(0)) + ->expects($this->exactly(3)) ->method('getSystemValue') - ->with('force_language', false) - ->willReturn(false); - $this->config - ->expects(self::at(1)) - ->method('getSystemValue') - ->with('installed', false) - ->willReturn(true); + ->willReturnMap([ + ['force_language', false, false], + ['installed', false, true], + ['default_language', false, 'es'] + ]); $user = $this->getMockBuilder(IUser::class) ->getMock(); $user->expects(self::once()) @@ -273,19 +250,6 @@ class FactoryTest extends TestCase { ->method('getUserValue') ->with('MyUserUid', 'core', 'lang', null) ->willReturn('jp'); - $factory->expects(self::at(1)) - ->method('languageExists') - ->with('MyApp', 'jp') - ->willReturn(false); - $this->config - ->expects(self::at(3)) - ->method('getSystemValue') - ->with('default_language', false) - ->willReturn('es'); - $factory->expects(self::at(2)) - ->method('languageExists') - ->with('MyApp', 'es') - ->willReturn(false); $this->config ->expects(self::never()) ->method('setUserValue') @@ -298,12 +262,12 @@ class FactoryTest extends TestCase { public function testFindLanguageWithForcedLanguage(): void { $factory = $this->getFactory(['languageExists']); $this->config - ->expects(self::at(0)) + ->expects($this->once()) ->method('getSystemValue') ->with('force_language', false) ->willReturn('de'); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('languageExists') ->with('MyApp', 'de') ->willReturn(true); |