@@ -184,17 +184,18 @@ public function testResourceFilesOptionLoadsBeforeOtherAddedResources($debug, $e
184184
185185 $ loader = $ this ->getMockBuilder ('Symfony\Component\Translation\Loader\LoaderInterface ' )->getMock ();
186186
187- $ loader ->expects ($ this ->at ( 0 ))
187+ $ loader ->expects ($ this ->exactly ( 2 ))
188188 ->method ('load ' )
189- /* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */
190- ->with ('messages.some_locale.loader ' , 'some_locale ' , 'messages ' )
191- ->willReturn ($ someCatalogue );
192-
193- $ loader ->expects ($ this ->at (1 ))
194- ->method ('load ' )
195- /* This resource is added by an addResource() call and shall be loaded after the resource_files */
196- ->with ('second_resource.some_locale.loader ' , 'some_locale ' , 'messages ' )
197- ->willReturn ($ someCatalogue );
189+ ->withConsecutive (
190+ /* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */
191+ ['messages.some_locale.loader ' , 'some_locale ' , 'messages ' ],
192+ /* This resource is added by an addResource() call and shall be loaded after the resource_files */
193+ ['second_resource.some_locale.loader ' , 'some_locale ' , 'messages ' ]
194+ )
195+ ->willReturnOnConsecutiveCalls (
196+ $ someCatalogue ,
197+ $ someCatalogue
198+ );
198199
199200 $ options = [
200201 'resource_files ' => ['some_locale ' => ['messages.some_locale.loader ' ]],
@@ -301,55 +302,33 @@ protected function getLoader()
301302 {
302303 $ loader = $ this ->getMockBuilder ('Symfony\Component\Translation\Loader\LoaderInterface ' )->getMock ();
303304 $ loader
304- ->expects ($ this ->at (0 ))
305- ->method ('load ' )
306- ->willReturn ($ this ->getCatalogue ('fr ' , [
307- 'foo ' => 'foo (FR) ' ,
308- ]))
309- ;
310- $ loader
311- ->expects ($ this ->at (1 ))
312- ->method ('load ' )
313- ->willReturn ($ this ->getCatalogue ('en ' , [
314- 'foo ' => 'foo (EN) ' ,
315- 'bar ' => 'bar (EN) ' ,
316- 'choice ' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN) ' ,
317- ]))
318- ;
319- $ loader
320- ->expects ($ this ->at (2 ))
321- ->method ('load ' )
322- ->willReturn ($ this ->getCatalogue ('es ' , [
323- 'foobar ' => 'foobar (ES) ' ,
324- ]))
325- ;
326- $ loader
327- ->expects ($ this ->at (3 ))
328- ->method ('load ' )
329- ->willReturn ($ this ->getCatalogue ('pt-PT ' , [
330- 'foobarfoo ' => 'foobarfoo (PT-PT) ' ,
331- ]))
332- ;
333- $ loader
334- ->expects ($ this ->at (4 ))
335- ->method ('load ' )
336- ->willReturn ($ this ->getCatalogue ('pt_BR ' , [
337- 'other choice ' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR) ' ,
338- ]))
339- ;
340- $ loader
341- ->expects ($ this ->at (5 ))
342- ->method ('load ' )
343- ->willReturn ($ this ->getCatalogue ('fr.UTF-8 ' , [
344- 'foobarbaz ' => 'foobarbaz (fr.UTF-8) ' ,
345- ]))
346- ;
347- $ loader
348- ->expects ($ this ->at (6 ))
305+ ->expects ($ this ->exactly (7 ))
349306 ->method ('load ' )
350- ->willReturn ($ this ->getCatalogue ('sr@latin ' , [
351- 'foobarbax ' => 'foobarbax (sr@latin) ' ,
352- ]))
307+ ->willReturnOnConsecutiveCalls (
308+ $ this ->getCatalogue ('fr ' , [
309+ 'foo ' => 'foo (FR) ' ,
310+ ]),
311+ $ this ->getCatalogue ('en ' , [
312+ 'foo ' => 'foo (EN) ' ,
313+ 'bar ' => 'bar (EN) ' ,
314+ 'choice ' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN) ' ,
315+ ]),
316+ $ this ->getCatalogue ('es ' , [
317+ 'foobar ' => 'foobar (ES) ' ,
318+ ]),
319+ $ this ->getCatalogue ('pt-PT ' , [
320+ 'foobarfoo ' => 'foobarfoo (PT-PT) ' ,
321+ ]),
322+ $ this ->getCatalogue ('pt_BR ' , [
323+ 'other choice ' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR) ' ,
324+ ]),
325+ $ this ->getCatalogue ('fr.UTF-8 ' , [
326+ 'foobarbaz ' => 'foobarbaz (fr.UTF-8) ' ,
327+ ]),
328+ $ this ->getCatalogue ('sr@latin ' , [
329+ 'foobarbax ' => 'foobarbax (sr@latin) ' ,
330+ ])
331+ )
353332 ;
354333
355334 return $ loader ;
0 commit comments