@@ -146,20 +146,21 @@ public function testFindLanguageWithNotExistingRequestLanguageAndExistingStoredU
146146 public function testFindLanguageWithNotExistingRequestLanguageAndNotExistingStoredUserLanguage (): void {
147147 $ factory = $ this ->getFactory (['languageExists ' ], true );
148148 $ this ->invokePrivate ($ factory , 'requestLanguage ' , ['de ' ]);
149- $ factory ->expects (self ::at (0 ))
150- ->method ('languageExists ' )
151- ->with ('MyApp ' , 'de ' )
152- ->willReturn (false );
149+ $ factory ->expects ($ this ->exactly (3 ))
150+ ->method ('languageExists ' )
151+ ->willReturnMap ([
152+ ['MyApp ' , 'de ' , false ],
153+ ['MyApp ' , 'jp ' , false ],
154+ ['MyApp ' , 'es ' , true ],
155+ ]);
153156 $ this ->config
154- ->expects (self :: at ( 0 ))
157+ ->expects ($ this -> exactly ( 3 ))
155158 ->method ('getSystemValue ' )
156- ->with ('force_language ' , false )
157- ->willReturn (false );
158- $ this ->config
159- ->expects (self ::at (1 ))
160- ->method ('getSystemValue ' )
161- ->with ('installed ' , false )
162- ->willReturn (true );
159+ ->willReturnMap ([
160+ ['force_language ' , false , false ],
161+ ['installed ' , false , true ],
162+ ['default_language ' , false , 'es ' ]
163+ ]);
163164 $ user = $ this ->getMockBuilder (IUser::class)
164165 ->getMock ();
165166 $ user ->expects (self ::once ())
@@ -174,40 +175,28 @@ public function testFindLanguageWithNotExistingRequestLanguageAndNotExistingStor
174175 ->method ('getUserValue ' )
175176 ->with ('MyUserUid ' , 'core ' , 'lang ' , null )
176177 ->willReturn ('jp ' );
177- $ factory ->expects (self ::at (1 ))
178- ->method ('languageExists ' )
179- ->with ('MyApp ' , 'jp ' )
180- ->willReturn (false );
181- $ this ->config
182- ->expects (self ::at (3 ))
183- ->method ('getSystemValue ' )
184- ->with ('default_language ' , false )
185- ->willReturn ('es ' );
186- $ factory ->expects (self ::at (2 ))
187- ->method ('languageExists ' )
188- ->with ('MyApp ' , 'es ' )
189- ->willReturn (true );
190178
191179 self ::assertSame ('es ' , $ factory ->findLanguage ('MyApp ' ));
192180 }
193181
194182 public function testFindLanguageWithNotExistingRequestLanguageAndNotExistingStoredUserLanguageAndNotExistingDefault (): void {
195183 $ factory = $ this ->getFactory (['languageExists ' ], true );
196184 $ this ->invokePrivate ($ factory , 'requestLanguage ' , ['de ' ]);
197- $ factory ->expects (self ::at (0 ))
198- ->method ('languageExists ' )
199- ->with ('MyApp ' , 'de ' )
200- ->willReturn (false );
185+ $ factory ->expects ($ this ->exactly (3 ))
186+ ->method ('languageExists ' )
187+ ->willReturnMap ([
188+ ['MyApp ' , 'de ' , false ],
189+ ['MyApp ' , 'jp ' , false ],
190+ ['MyApp ' , 'es ' , false ],
191+ ]);
201192 $ this ->config
202- ->expects (self :: at ( 0 ))
193+ ->expects ($ this -> exactly ( 3 ))
203194 ->method ('getSystemValue ' )
204- ->with ('force_language ' , false )
205- ->willReturn (false );
206- $ this ->config
207- ->expects (self ::at (1 ))
208- ->method ('getSystemValue ' )
209- ->with ('installed ' , false )
210- ->willReturn (true );
195+ ->willReturnMap ([
196+ ['force_language ' , false , false ],
197+ ['installed ' , false , true ],
198+ ['default_language ' , false , 'es ' ]
199+ ]);
211200 $ user = $ this ->getMockBuilder (IUser::class)
212201 ->getMock ();
213202 $ user ->expects (self ::once ())
@@ -222,19 +211,6 @@ public function testFindLanguageWithNotExistingRequestLanguageAndNotExistingStor
222211 ->method ('getUserValue ' )
223212 ->with ('MyUserUid ' , 'core ' , 'lang ' , null )
224213 ->willReturn ('jp ' );
225- $ factory ->expects (self ::at (1 ))
226- ->method ('languageExists ' )
227- ->with ('MyApp ' , 'jp ' )
228- ->willReturn (false );
229- $ this ->config
230- ->expects (self ::at (3 ))
231- ->method ('getSystemValue ' )
232- ->with ('default_language ' , false )
233- ->willReturn ('es ' );
234- $ factory ->expects (self ::at (2 ))
235- ->method ('languageExists ' )
236- ->with ('MyApp ' , 'es ' )
237- ->willReturn (false );
238214 $ this ->config
239215 ->expects (self ::never ())
240216 ->method ('setUserValue ' );
@@ -245,20 +221,21 @@ public function testFindLanguageWithNotExistingRequestLanguageAndNotExistingStor
245221 public function testFindLanguageWithNotExistingRequestLanguageAndNotExistingStoredUserLanguageAndNotExistingDefaultAndNoAppInScope (): void {
246222 $ factory = $ this ->getFactory (['languageExists ' ], true );
247223 $ this ->invokePrivate ($ factory , 'requestLanguage ' , ['de ' ]);
248- $ factory ->expects (self ::at (0 ))
249- ->method ('languageExists ' )
250- ->with ('MyApp ' , 'de ' )
251- ->willReturn (false );
224+ $ factory ->expects ($ this ->exactly (3 ))
225+ ->method ('languageExists ' )
226+ ->willReturnMap ([
227+ ['MyApp ' , 'de ' , false ],
228+ ['MyApp ' , 'jp ' , false ],
229+ ['MyApp ' , 'es ' , false ],
230+ ]);
252231 $ this ->config
253- ->expects (self :: at ( 0 ))
232+ ->expects ($ this -> exactly ( 3 ))
254233 ->method ('getSystemValue ' )
255- ->with ('force_language ' , false )
256- ->willReturn (false );
257- $ this ->config
258- ->expects (self ::at (1 ))
259- ->method ('getSystemValue ' )
260- ->with ('installed ' , false )
261- ->willReturn (true );
234+ ->willReturnMap ([
235+ ['force_language ' , false , false ],
236+ ['installed ' , false , true ],
237+ ['default_language ' , false , 'es ' ]
238+ ]);
262239 $ user = $ this ->getMockBuilder (IUser::class)
263240 ->getMock ();
264241 $ user ->expects (self ::once ())
@@ -273,19 +250,6 @@ public function testFindLanguageWithNotExistingRequestLanguageAndNotExistingStor
273250 ->method ('getUserValue ' )
274251 ->with ('MyUserUid ' , 'core ' , 'lang ' , null )
275252 ->willReturn ('jp ' );
276- $ factory ->expects (self ::at (1 ))
277- ->method ('languageExists ' )
278- ->with ('MyApp ' , 'jp ' )
279- ->willReturn (false );
280- $ this ->config
281- ->expects (self ::at (3 ))
282- ->method ('getSystemValue ' )
283- ->with ('default_language ' , false )
284- ->willReturn ('es ' );
285- $ factory ->expects (self ::at (2 ))
286- ->method ('languageExists ' )
287- ->with ('MyApp ' , 'es ' )
288- ->willReturn (false );
289253 $ this ->config
290254 ->expects (self ::never ())
291255 ->method ('setUserValue ' )
@@ -298,12 +262,12 @@ public function testFindLanguageWithNotExistingRequestLanguageAndNotExistingStor
298262 public function testFindLanguageWithForcedLanguage (): void {
299263 $ factory = $ this ->getFactory (['languageExists ' ]);
300264 $ this ->config
301- ->expects (self :: at ( 0 ))
265+ ->expects ($ this -> once ( ))
302266 ->method ('getSystemValue ' )
303267 ->with ('force_language ' , false )
304268 ->willReturn ('de ' );
305269
306- $ factory ->expects (self :: once ())
270+ $ factory ->expects ($ this -> once ())
307271 ->method ('languageExists ' )
308272 ->with ('MyApp ' , 'de ' )
309273 ->willReturn (true );
0 commit comments