@@ -99,9 +99,7 @@ class UpdateItemOptionsTest extends TestCase
99
99
protected $ formKeyValidator ;
100
100
101
101
/**
102
- * SetUp method
103
- *
104
- * @return void
102
+ * @inheritDoc
105
103
*/
106
104
protected function setUp (): void
107
105
{
@@ -132,9 +130,7 @@ protected function setUp(): void
132
130
}
133
131
134
132
/**
135
- * TearDown method
136
- *
137
- * @return void
133
+ * @inheritDoc
138
134
*/
139
135
protected function tearDown (): void
140
136
{
@@ -155,7 +151,7 @@ protected function tearDown(): void
155
151
*
156
152
* @return void
157
153
*/
158
- public function prepareContext ()
154
+ public function prepareContext (): void
159
155
{
160
156
$ actionFlag = $ this ->createMock (ActionFlag::class);
161
157
@@ -211,7 +207,10 @@ protected function getController()
211
207
);
212
208
}
213
209
214
- public function testExecuteWithInvalidFormKey ()
210
+ /**
211
+ * @return void
212
+ */
213
+ public function testExecuteWithInvalidFormKey (): void
215
214
{
216
215
$ this ->prepareContext ();
217
216
@@ -235,11 +234,11 @@ public function testExecuteWithInvalidFormKey()
235
234
}
236
235
237
236
/**
238
- * Test execute without product id
237
+ * Test execute without product id.
239
238
*
240
239
* @return void
241
240
*/
242
- public function testExecuteWithoutProductId ()
241
+ public function testExecuteWithoutProductId (): void
243
242
{
244
243
$ this ->request
245
244
->expects ($ this ->once ())
@@ -255,11 +254,11 @@ public function testExecuteWithoutProductId()
255
254
}
256
255
257
256
/**
258
- * Test execute without product
257
+ * Test execute without product.
259
258
*
260
259
* @return void
261
260
*/
262
- public function testExecuteWithoutProduct ()
261
+ public function testExecuteWithoutProduct (): void
263
262
{
264
263
$ this ->request
265
264
->expects ($ this ->once ())
@@ -287,11 +286,11 @@ public function testExecuteWithoutProduct()
287
286
}
288
287
289
288
/**
290
- * Test execute without wish list
289
+ * Test execute without wish list.
291
290
*
292
291
* @return void
293
292
*/
294
- public function testExecuteWithoutWishList ()
293
+ public function testExecuteWithoutWishList (): void
295
294
{
296
295
$ product = $ this ->createMock (Product::class);
297
296
$ item = $ this ->createMock (Item::class);
@@ -302,15 +301,9 @@ public function testExecuteWithoutWishList()
302
301
->willReturn (true );
303
302
304
303
$ this ->request
305
- ->expects ($ this ->at (0 ))
306
304
->method ('getParam ' )
307
- ->with ('product ' , null )
308
- ->willReturn (2 );
309
- $ this ->request
310
- ->expects ($ this ->at (1 ))
311
- ->method ('getParam ' )
312
- ->with ('id ' , null )
313
- ->willReturn (3 );
305
+ ->withConsecutive (['product ' , null ], ['id ' , null ])
306
+ ->willReturnOnConsecutiveCalls (2 , 3 );
314
307
315
308
$ this ->productRepository
316
309
->expects ($ this ->once ())
@@ -355,12 +348,12 @@ public function testExecuteWithoutWishList()
355
348
}
356
349
357
350
/**
358
- * Test execute add success exception
351
+ * Test execute add success exception.
359
352
*
360
353
* @return void
361
354
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
362
355
*/
363
- public function testExecuteAddSuccessException ()
356
+ public function testExecuteAddSuccessException (): void
364
357
{
365
358
$ wishlist = $ this ->createMock (Wishlist::class);
366
359
$ product = $ this ->createMock (Product::class);
@@ -401,15 +394,9 @@ public function testExecuteAddSuccessException()
401
394
->willReturn ('Test name ' );
402
395
403
396
$ this ->request
404
- ->expects ($ this ->at (0 ))
405
- ->method ('getParam ' )
406
- ->with ('product ' , null )
407
- ->willReturn (2 );
408
- $ this ->request
409
- ->expects ($ this ->at (1 ))
410
397
->method ('getParam ' )
411
- ->with ( ' id ' , null )
412
- ->willReturn ( 3 );
398
+ ->withConsecutive ([ ' product ' , null ], [ ' id ' , null ] )
399
+ ->willReturnOnConsecutiveCalls ( 2 , 3 );
413
400
414
401
$ this ->productRepository
415
402
->expects ($ this ->once ())
@@ -476,12 +463,12 @@ public function testExecuteAddSuccessException()
476
463
}
477
464
478
465
/**
479
- * Test execute add success critical exception
466
+ * Test execute add success critical exception.
480
467
*
481
468
* @return void
482
469
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
483
470
*/
484
- public function testExecuteAddSuccessCriticalException ()
471
+ public function testExecuteAddSuccessCriticalException (): void
485
472
{
486
473
$ wishlist = $ this ->createMock (Wishlist::class);
487
474
$ product = $ this ->createMock (Product::class);
@@ -493,8 +480,7 @@ public function testExecuteAddSuccessCriticalException()
493
480
$ logger
494
481
->expects ($ this ->once ())
495
482
->method ('critical ' )
496
- ->with ($ exception )
497
- ->willReturn (true );
483
+ ->with ($ exception );
498
484
499
485
$ helper
500
486
->expects ($ this ->exactly (2 ))
@@ -530,15 +516,9 @@ public function testExecuteAddSuccessCriticalException()
530
516
->willReturn ('Test name ' );
531
517
532
518
$ this ->request
533
- ->expects ($ this ->at (0 ))
534
- ->method ('getParam ' )
535
- ->with ('product ' , null )
536
- ->willReturn (2 );
537
- $ this ->request
538
- ->expects ($ this ->at (1 ))
539
519
->method ('getParam ' )
540
- ->with ( ' id ' , null )
541
- ->willReturn ( 3 );
520
+ ->withConsecutive ([ ' product ' , null ], [ ' id ' , null ] )
521
+ ->willReturnOnConsecutiveCalls ( 2 , 3 );
542
522
543
523
$ this ->productRepository
544
524
->expects ($ this ->once ())
@@ -575,20 +555,9 @@ public function testExecuteAddSuccessCriticalException()
575
555
->willReturn ([]);
576
556
577
557
$ this ->om
578
- ->expects ($ this ->at (1 ))
579
- ->method ('get ' )
580
- ->with (Data::class)
581
- ->willReturn ($ helper );
582
- $ this ->om
583
- ->expects ($ this ->at (2 ))
584
- ->method ('get ' )
585
- ->with (Data::class)
586
- ->willReturn ($ helper );
587
- $ this ->om
588
- ->expects ($ this ->at (3 ))
589
558
->method ('get ' )
590
- ->with ( LoggerInterface::class)
591
- ->willReturn ( $ logger );
559
+ ->withConsecutive ([Data::class], [Data::class], [ LoggerInterface::class] )
560
+ ->willReturnOnConsecutiveCalls ( $ helper , $ helper , $ logger );
592
561
593
562
$ this ->eventManager
594
563
->expects ($ this ->once ())
0 commit comments