@@ -137,14 +137,10 @@ public function testCreateFromChoicesSameValueClosure()
137
137
$ list2 = new ArrayChoiceList ([]);
138
138
$ closure = function () {};
139
139
140
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
141
- ->method ('createListFromChoices ' )
142
- ->with ($ choices , $ closure )
143
- ->willReturn ($ list1 );
144
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
140
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
145
141
->method ('createListFromChoices ' )
146
142
->with ($ choices , $ closure )
147
- ->willReturn ( $ list2 );
143
+ ->willReturnOnConsecutiveCalls ( $ list1 , $ list2 );
148
144
149
145
$ this ->assertSame ($ list1 , $ this ->factory ->createListFromChoices ($ choices , $ closure ));
150
146
$ this ->assertSame ($ list2 , $ this ->factory ->createListFromChoices ($ choices , $ closure ));
@@ -194,14 +190,10 @@ public function testCreateFromChoicesSameFilterClosure()
194
190
$ list2 = new ArrayChoiceList ([]);
195
191
$ filter = function () {};
196
192
197
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
198
- ->method ('createListFromChoices ' )
199
- ->with ($ choices , null , $ filter )
200
- ->willReturn ($ list1 );
201
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
193
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
202
194
->method ('createListFromChoices ' )
203
195
->with ($ choices , null , $ filter )
204
- ->willReturn ( $ list2 );
196
+ ->willReturnOnConsecutiveCalls ( $ list1 , $ list2 );
205
197
206
198
$ this ->assertSame ($ list1 , $ this ->factory ->createListFromChoices ($ choices , null , $ filter ));
207
199
$ this ->assertSame ($ list2 , $ this ->factory ->createListFromChoices ($ choices , null , $ filter ));
@@ -232,14 +224,13 @@ public function testCreateFromChoicesDifferentFilterClosure()
232
224
$ closure1 = function () {};
233
225
$ closure2 = function () {};
234
226
235
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
236
- ->method ('createListFromChoices ' )
237
- ->with ($ choices , null , $ closure1 )
238
- ->willReturn ($ list1 );
239
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
227
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
240
228
->method ('createListFromChoices ' )
241
- ->with ($ choices , null , $ closure2 )
242
- ->willReturn ($ list2 );
229
+ ->withConsecutive (
230
+ [$ choices , null , $ closure1 ],
231
+ [$ choices , null , $ closure2 ]
232
+ )
233
+ ->willReturnOnConsecutiveCalls ($ list1 , $ list2 );
243
234
244
235
$ this ->assertSame ($ list1 , $ this ->factory ->createListFromChoices ($ choices , null , $ closure1 ));
245
236
$ this ->assertSame ($ list2 , $ this ->factory ->createListFromChoices ($ choices , null , $ closure2 ));
@@ -251,16 +242,10 @@ public function testCreateFromLoaderSameLoader()
251
242
$ list = new ArrayChoiceList ([]);
252
243
$ list2 = new ArrayChoiceList ([]);
253
244
254
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
255
- ->method ('createListFromLoader ' )
256
- ->with ($ loader )
257
- ->willReturn ($ list )
258
- ;
259
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
245
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
260
246
->method ('createListFromLoader ' )
261
247
->with ($ loader )
262
- ->willReturn ($ list2 )
263
- ;
248
+ ->willReturnOnConsecutiveCalls ($ list , $ list2 );
264
249
265
250
$ this ->assertSame ($ list , $ this ->factory ->createListFromLoader ($ loader ));
266
251
$ this ->assertSame ($ list2 , $ this ->factory ->createListFromLoader ($ loader ));
@@ -309,16 +294,10 @@ public function testCreateFromLoaderSameValueClosure()
309
294
$ list2 = new ArrayChoiceList ([]);
310
295
$ closure = function () {};
311
296
312
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
313
- ->method ('createListFromLoader ' )
314
- ->with ($ loader , $ closure )
315
- ->willReturn ($ list )
316
- ;
317
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
297
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
318
298
->method ('createListFromLoader ' )
319
299
->with ($ loader , $ closure )
320
- ->willReturn ($ list2 )
321
- ;
300
+ ->willReturnOnConsecutiveCalls ($ list , $ list2 );
322
301
323
302
$ this ->assertSame ($ list , $ this ->factory ->createListFromLoader (ChoiceList::loader ($ type , $ loader ), $ closure ));
324
303
$ this ->assertSame ($ list2 , $ this ->factory ->createListFromLoader (ChoiceList::loader ($ type , $ this ->createMock (ChoiceLoaderInterface::class)), $ closure ));
@@ -376,16 +355,10 @@ public function testCreateFromLoaderSameFilterClosure()
376
355
$ list2 = new ArrayChoiceList ([]);
377
356
$ closure = function () {};
378
357
379
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
380
- ->method ('createListFromLoader ' )
381
- ->with ($ loader , null , $ closure )
382
- ->willReturn ($ list )
383
- ;
384
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
358
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
385
359
->method ('createListFromLoader ' )
386
360
->with ($ loader , null , $ closure )
387
- ->willReturn ($ list2 )
388
- ;
361
+ ->willReturnOnConsecutiveCalls ($ list , $ list2 );
389
362
390
363
$ this ->assertSame ($ list , $ this ->factory ->createListFromLoader (ChoiceList::loader ($ type , $ loader ), null , $ closure ));
391
364
$ this ->assertSame ($ list2 , $ this ->factory ->createListFromLoader (ChoiceList::loader ($ type , $ this ->createMock (ChoiceLoaderInterface::class)), null , $ closure ));
@@ -425,14 +398,13 @@ public function testCreateFromLoaderDifferentFilterClosure()
425
398
$ closure1 = function () {};
426
399
$ closure2 = function () {};
427
400
428
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
429
- ->method ('createListFromLoader ' )
430
- ->with ($ loader , null , $ closure1 )
431
- ->willReturn ($ list1 );
432
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
401
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
433
402
->method ('createListFromLoader ' )
434
- ->with ($ loader , null , $ closure2 )
435
- ->willReturn ($ list2 );
403
+ ->withConsecutive (
404
+ [$ loader , null , $ closure1 ],
405
+ [$ loader , null , $ closure2 ]
406
+ )
407
+ ->willReturnOnConsecutiveCalls ($ list1 , $ list2 );
436
408
437
409
$ this ->assertSame ($ list1 , $ this ->factory ->createListFromLoader (ChoiceList::loader ($ type , $ loader ), null , $ closure1 ));
438
410
$ this ->assertSame ($ list2 , $ this ->factory ->createListFromLoader (ChoiceList::loader ($ type , $ this ->createMock (ChoiceLoaderInterface::class)), null , $ closure2 ));
@@ -445,16 +417,10 @@ public function testCreateViewSamePreferredChoices()
445
417
$ view = new ChoiceListView ();
446
418
$ view2 = new ChoiceListView ();
447
419
448
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
449
- ->method ('createView ' )
450
- ->with ($ list , $ preferred )
451
- ->willReturn ($ view )
452
- ;
453
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
420
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
454
421
->method ('createView ' )
455
422
->with ($ list , $ preferred )
456
- ->willReturn ($ view2 )
457
- ;
423
+ ->willReturnOnConsecutiveCalls ($ view , $ view2 );
458
424
459
425
$ this ->assertSame ($ view , $ this ->factory ->createView ($ list , $ preferred ));
460
426
$ this ->assertSame ($ view2 , $ this ->factory ->createView ($ list , $ preferred ));
@@ -504,16 +470,10 @@ public function testCreateViewSamePreferredChoicesClosure()
504
470
$ view = new ChoiceListView ();
505
471
$ view2 = new ChoiceListView ();
506
472
507
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
508
- ->method ('createView ' )
509
- ->with ($ list , $ preferred )
510
- ->willReturn ($ view )
511
- ;
512
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
473
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
513
474
->method ('createView ' )
514
475
->with ($ list , $ preferred )
515
- ->willReturn ($ view2 )
516
- ;
476
+ ->willReturnOnConsecutiveCalls ($ view , $ view2 );
517
477
518
478
$ this ->assertSame ($ view , $ this ->factory ->createView ($ list , $ preferred ));
519
479
$ this ->assertSame ($ view2 , $ this ->factory ->createView ($ list , $ preferred ));
@@ -563,16 +523,10 @@ public function testCreateViewSameLabelClosure()
563
523
$ view = new ChoiceListView ();
564
524
$ view2 = new ChoiceListView ();
565
525
566
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
567
- ->method ('createView ' )
568
- ->with ($ list , null , $ labels )
569
- ->willReturn ($ view )
570
- ;
571
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
526
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
572
527
->method ('createView ' )
573
528
->with ($ list , null , $ labels )
574
- ->willReturn ($ view2 )
575
- ;
529
+ ->willReturnOnConsecutiveCalls ($ view , $ view2 );
576
530
577
531
$ this ->assertSame ($ view , $ this ->factory ->createView ($ list , null , $ labels ));
578
532
$ this ->assertSame ($ view2 , $ this ->factory ->createView ($ list , null , $ labels ));
@@ -622,16 +576,10 @@ public function testCreateViewSameIndexClosure()
622
576
$ view = new ChoiceListView ();
623
577
$ view2 = new ChoiceListView ();
624
578
625
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
626
- ->method ('createView ' )
627
- ->with ($ list , null , null , $ index )
628
- ->willReturn ($ view )
629
- ;
630
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
579
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
631
580
->method ('createView ' )
632
581
->with ($ list , null , null , $ index )
633
- ->willReturn ($ view2 )
634
- ;
582
+ ->willReturnOnConsecutiveCalls ($ view , $ view2 );
635
583
636
584
$ this ->assertSame ($ view , $ this ->factory ->createView ($ list , null , null , $ index ));
637
585
$ this ->assertSame ($ view2 , $ this ->factory ->createView ($ list , null , null , $ index ));
@@ -681,16 +629,10 @@ public function testCreateViewSameGroupByClosure()
681
629
$ view = new ChoiceListView ();
682
630
$ view2 = new ChoiceListView ();
683
631
684
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
685
- ->method ('createView ' )
686
- ->with ($ list , null , null , null , $ groupBy )
687
- ->willReturn ($ view )
688
- ;
689
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
632
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
690
633
->method ('createView ' )
691
634
->with ($ list , null , null , null , $ groupBy )
692
- ->willReturn ($ view2 )
693
- ;
635
+ ->willReturnOnConsecutiveCalls ($ view , $ view2 );
694
636
695
637
$ this ->assertSame ($ view , $ this ->factory ->createView ($ list , null , null , null , $ groupBy ));
696
638
$ this ->assertSame ($ view2 , $ this ->factory ->createView ($ list , null , null , null , $ groupBy ));
@@ -740,16 +682,10 @@ public function testCreateViewSameAttributes()
740
682
$ view = new ChoiceListView ();
741
683
$ view2 = new ChoiceListView ();
742
684
743
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
744
- ->method ('createView ' )
745
- ->with ($ list , null , null , null , null , $ attr )
746
- ->willReturn ($ view )
747
- ;
748
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
685
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
749
686
->method ('createView ' )
750
687
->with ($ list , null , null , null , null , $ attr )
751
- ->willReturn ($ view2 )
752
- ;
688
+ ->willReturnOnConsecutiveCalls ($ view , $ view2 );
753
689
754
690
$ this ->assertSame ($ view , $ this ->factory ->createView ($ list , null , null , null , null , $ attr ));
755
691
$ this ->assertSame ($ view2 , $ this ->factory ->createView ($ list , null , null , null , null , $ attr ));
@@ -798,16 +734,10 @@ public function testCreateViewSameAttributesClosure()
798
734
$ view = new ChoiceListView ();
799
735
$ view2 = new ChoiceListView ();
800
736
801
- $ this ->decoratedFactory ->expects ($ this ->at (0 ))
802
- ->method ('createView ' )
803
- ->with ($ list , null , null , null , null , $ attr )
804
- ->willReturn ($ view )
805
- ;
806
- $ this ->decoratedFactory ->expects ($ this ->at (1 ))
737
+ $ this ->decoratedFactory ->expects ($ this ->exactly (2 ))
807
738
->method ('createView ' )
808
739
->with ($ list , null , null , null , null , $ attr )
809
- ->willReturn ($ view2 )
810
- ;
740
+ ->willReturnOnConsecutiveCalls ($ view , $ view2 );
811
741
812
742
$ this ->assertSame ($ view , $ this ->factory ->createView ($ list , null , null , null , null , $ attr ));
813
743
$ this ->assertSame ($ view2 , $ this ->factory ->createView ($ list , null , null , null , null , $ attr ));
0 commit comments