@@ -297,17 +297,18 @@ public function testResourceFilesOptionLoadsBeforeOtherAddedResources($debug, $e
297297
298298 $ loader = $ this ->getMockBuilder ('Symfony\Component\Translation\Loader\LoaderInterface ' )->getMock ();
299299
300- $ loader ->expects ($ this ->at ( 0 ))
300+ $ loader ->expects ($ this ->exactly ( 2 ))
301301 ->method ('load ' )
302- /* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */
303- ->with ('messages.some_locale.loader ' , 'some_locale ' , 'messages ' )
304- ->willReturn ($ someCatalogue );
305-
306- $ loader ->expects ($ this ->at (1 ))
307- ->method ('load ' )
308- /* This resource is added by an addResource() call and shall be loaded after the resource_files */
309- ->with ('second_resource.some_locale.loader ' , 'some_locale ' , 'messages ' )
310- ->willReturn ($ someCatalogue );
302+ ->withConsecutive (
303+ /* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */
304+ ['messages.some_locale.loader ' , 'some_locale ' , 'messages ' ],
305+ /* This resource is added by an addResource() call and shall be loaded after the resource_files */
306+ ['second_resource.some_locale.loader ' , 'some_locale ' , 'messages ' ]
307+ )
308+ ->willReturnOnConsecutiveCalls (
309+ $ someCatalogue ,
310+ $ someCatalogue
311+ );
311312
312313 $ options = [
313314 'resource_files ' => ['some_locale ' => ['messages.some_locale.loader ' ]],
@@ -352,55 +353,33 @@ protected function getLoader()
352353 {
353354 $ loader = $ this ->getMockBuilder ('Symfony\Component\Translation\Loader\LoaderInterface ' )->getMock ();
354355 $ loader
355- ->expects ($ this ->at (0 ))
356- ->method ('load ' )
357- ->willReturn ($ this ->getCatalogue ('fr ' , [
358- 'foo ' => 'foo (FR) ' ,
359- ]))
360- ;
361- $ loader
362- ->expects ($ this ->at (1 ))
363- ->method ('load ' )
364- ->willReturn ($ this ->getCatalogue ('en ' , [
365- 'foo ' => 'foo (EN) ' ,
366- 'bar ' => 'bar (EN) ' ,
367- 'choice ' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN) ' ,
368- ]))
369- ;
370- $ loader
371- ->expects ($ this ->at (2 ))
372- ->method ('load ' )
373- ->willReturn ($ this ->getCatalogue ('es ' , [
374- 'foobar ' => 'foobar (ES) ' ,
375- ]))
376- ;
377- $ loader
378- ->expects ($ this ->at (3 ))
379- ->method ('load ' )
380- ->willReturn ($ this ->getCatalogue ('pt-PT ' , [
381- 'foobarfoo ' => 'foobarfoo (PT-PT) ' ,
382- ]))
383- ;
384- $ loader
385- ->expects ($ this ->at (4 ))
386- ->method ('load ' )
387- ->willReturn ($ this ->getCatalogue ('pt_BR ' , [
388- 'other choice ' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR) ' ,
389- ]))
390- ;
391- $ loader
392- ->expects ($ this ->at (5 ))
393- ->method ('load ' )
394- ->willReturn ($ this ->getCatalogue ('fr.UTF-8 ' , [
395- 'foobarbaz ' => 'foobarbaz (fr.UTF-8) ' ,
396- ]))
397- ;
398- $ loader
399- ->expects ($ this ->at (6 ))
356+ ->expects ($ this ->exactly (7 ))
400357 ->method ('load ' )
401- ->willReturn ($ this ->getCatalogue ('sr@latin ' , [
402- 'foobarbax ' => 'foobarbax (sr@latin) ' ,
403- ]))
358+ ->willReturnOnConsecutiveCalls (
359+ $ this ->getCatalogue ('fr ' , [
360+ 'foo ' => 'foo (FR) ' ,
361+ ]),
362+ $ this ->getCatalogue ('en ' , [
363+ 'foo ' => 'foo (EN) ' ,
364+ 'bar ' => 'bar (EN) ' ,
365+ 'choice ' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN) ' ,
366+ ]),
367+ $ this ->getCatalogue ('es ' , [
368+ 'foobar ' => 'foobar (ES) ' ,
369+ ]),
370+ $ this ->getCatalogue ('pt-PT ' , [
371+ 'foobarfoo ' => 'foobarfoo (PT-PT) ' ,
372+ ]),
373+ $ this ->getCatalogue ('pt_BR ' , [
374+ 'other choice ' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR) ' ,
375+ ]),
376+ $ this ->getCatalogue ('fr.UTF-8 ' , [
377+ 'foobarbaz ' => 'foobarbaz (fr.UTF-8) ' ,
378+ ]),
379+ $ this ->getCatalogue ('sr@latin ' , [
380+ 'foobarbax ' => 'foobarbax (sr@latin) ' ,
381+ ])
382+ )
404383 ;
405384
406385 return $ loader ;
0 commit comments