@@ -146,17 +146,18 @@ public function testResourceFilesOptionLoadsBeforeOtherAddedResources($debug, $e
146
146
147
147
$ loader = $ this ->getMockBuilder ('Symfony\Component\Translation\Loader\LoaderInterface ' )->getMock ();
148
148
149
- $ loader ->expects ($ this ->at ( 0 ))
149
+ $ loader ->expects ($ this ->exactly ( 2 ))
150
150
->method ('load ' )
151
- /* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */
152
- ->with ('messages.some_locale.loader ' , 'some_locale ' , 'messages ' )
153
- ->willReturn ($ someCatalogue );
154
-
155
- $ loader ->expects ($ this ->at (1 ))
156
- ->method ('load ' )
157
- /* This resource is added by an addResource() call and shall be loaded after the resource_files */
158
- ->with ('second_resource.some_locale.loader ' , 'some_locale ' , 'messages ' )
159
- ->willReturn ($ someCatalogue );
151
+ ->withConsecutive (
152
+ /* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */
153
+ ['messages.some_locale.loader ' , 'some_locale ' , 'messages ' ],
154
+ /* This resource is added by an addResource() call and shall be loaded after the resource_files */
155
+ ['second_resource.some_locale.loader ' , 'some_locale ' , 'messages ' ]
156
+ )
157
+ ->willReturnOnConsecutiveCalls (
158
+ $ someCatalogue ,
159
+ $ someCatalogue
160
+ );
160
161
161
162
$ options = [
162
163
'resource_files ' => ['some_locale ' => ['messages.some_locale.loader ' ]],
@@ -263,55 +264,33 @@ protected function getLoader()
263
264
{
264
265
$ loader = $ this ->getMockBuilder ('Symfony\Component\Translation\Loader\LoaderInterface ' )->getMock ();
265
266
$ loader
266
- ->expects ($ this ->at (0 ))
267
- ->method ('load ' )
268
- ->willReturn ($ this ->getCatalogue ('fr ' , [
269
- 'foo ' => 'foo (FR) ' ,
270
- ]))
271
- ;
272
- $ loader
273
- ->expects ($ this ->at (1 ))
274
- ->method ('load ' )
275
- ->willReturn ($ this ->getCatalogue ('en ' , [
276
- 'foo ' => 'foo (EN) ' ,
277
- 'bar ' => 'bar (EN) ' ,
278
- 'choice ' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN) ' ,
279
- ]))
280
- ;
281
- $ loader
282
- ->expects ($ this ->at (2 ))
283
- ->method ('load ' )
284
- ->willReturn ($ this ->getCatalogue ('es ' , [
285
- 'foobar ' => 'foobar (ES) ' ,
286
- ]))
287
- ;
288
- $ loader
289
- ->expects ($ this ->at (3 ))
290
- ->method ('load ' )
291
- ->willReturn ($ this ->getCatalogue ('pt-PT ' , [
292
- 'foobarfoo ' => 'foobarfoo (PT-PT) ' ,
293
- ]))
294
- ;
295
- $ loader
296
- ->expects ($ this ->at (4 ))
297
- ->method ('load ' )
298
- ->willReturn ($ this ->getCatalogue ('pt_BR ' , [
299
- 'other choice ' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR) ' ,
300
- ]))
301
- ;
302
- $ loader
303
- ->expects ($ this ->at (5 ))
304
- ->method ('load ' )
305
- ->willReturn ($ this ->getCatalogue ('fr.UTF-8 ' , [
306
- 'foobarbaz ' => 'foobarbaz (fr.UTF-8) ' ,
307
- ]))
308
- ;
309
- $ loader
310
- ->expects ($ this ->at (6 ))
267
+ ->expects ($ this ->exactly (7 ))
311
268
->method ('load ' )
312
- ->willReturn ($ this ->getCatalogue ('sr@latin ' , [
313
- 'foobarbax ' => 'foobarbax (sr@latin) ' ,
314
- ]))
269
+ ->willReturnOnConsecutiveCalls (
270
+ $ this ->getCatalogue ('fr ' , [
271
+ 'foo ' => 'foo (FR) ' ,
272
+ ]),
273
+ $ this ->getCatalogue ('en ' , [
274
+ 'foo ' => 'foo (EN) ' ,
275
+ 'bar ' => 'bar (EN) ' ,
276
+ 'choice ' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN) ' ,
277
+ ]),
278
+ $ this ->getCatalogue ('es ' , [
279
+ 'foobar ' => 'foobar (ES) ' ,
280
+ ]),
281
+ $ this ->getCatalogue ('pt-PT ' , [
282
+ 'foobarfoo ' => 'foobarfoo (PT-PT) ' ,
283
+ ]),
284
+ $ this ->getCatalogue ('pt_BR ' , [
285
+ 'other choice ' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR) ' ,
286
+ ]),
287
+ $ this ->getCatalogue ('fr.UTF-8 ' , [
288
+ 'foobarbaz ' => 'foobarbaz (fr.UTF-8) ' ,
289
+ ]),
290
+ $ this ->getCatalogue ('sr@latin ' , [
291
+ 'foobarbax ' => 'foobarbax (sr@latin) ' ,
292
+ ])
293
+ )
315
294
;
316
295
317
296
return $ loader ;
0 commit comments