Skip to content

Commit 66105e5

Browse files
CE-33707: Fixed missed files
1 parent 39079fd commit 66105e5

File tree

2 files changed

+599
-166
lines changed

2 files changed

+599
-166
lines changed

app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php

Lines changed: 26 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ class UpdateItemOptionsTest extends TestCase
9999
protected $formKeyValidator;
100100

101101
/**
102-
* SetUp method
103-
*
104-
* @return void
102+
* @inheritDoc
105103
*/
106104
protected function setUp(): void
107105
{
@@ -132,9 +130,7 @@ protected function setUp(): void
132130
}
133131

134132
/**
135-
* TearDown method
136-
*
137-
* @return void
133+
* @inheritDoc
138134
*/
139135
protected function tearDown(): void
140136
{
@@ -155,7 +151,7 @@ protected function tearDown(): void
155151
*
156152
* @return void
157153
*/
158-
public function prepareContext()
154+
public function prepareContext(): void
159155
{
160156
$actionFlag = $this->createMock(ActionFlag::class);
161157

@@ -211,7 +207,10 @@ protected function getController()
211207
);
212208
}
213209

214-
public function testExecuteWithInvalidFormKey()
210+
/**
211+
* @return void
212+
*/
213+
public function testExecuteWithInvalidFormKey(): void
215214
{
216215
$this->prepareContext();
217216

@@ -235,11 +234,11 @@ public function testExecuteWithInvalidFormKey()
235234
}
236235

237236
/**
238-
* Test execute without product id
237+
* Test execute without product id.
239238
*
240239
* @return void
241240
*/
242-
public function testExecuteWithoutProductId()
241+
public function testExecuteWithoutProductId(): void
243242
{
244243
$this->request
245244
->expects($this->once())
@@ -255,11 +254,11 @@ public function testExecuteWithoutProductId()
255254
}
256255

257256
/**
258-
* Test execute without product
257+
* Test execute without product.
259258
*
260259
* @return void
261260
*/
262-
public function testExecuteWithoutProduct()
261+
public function testExecuteWithoutProduct(): void
263262
{
264263
$this->request
265264
->expects($this->once())
@@ -287,11 +286,11 @@ public function testExecuteWithoutProduct()
287286
}
288287

289288
/**
290-
* Test execute without wish list
289+
* Test execute without wish list.
291290
*
292291
* @return void
293292
*/
294-
public function testExecuteWithoutWishList()
293+
public function testExecuteWithoutWishList(): void
295294
{
296295
$product = $this->createMock(Product::class);
297296
$item = $this->createMock(Item::class);
@@ -302,15 +301,9 @@ public function testExecuteWithoutWishList()
302301
->willReturn(true);
303302

304303
$this->request
305-
->expects($this->at(0))
306304
->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);
314307

315308
$this->productRepository
316309
->expects($this->once())
@@ -355,12 +348,12 @@ public function testExecuteWithoutWishList()
355348
}
356349

357350
/**
358-
* Test execute add success exception
351+
* Test execute add success exception.
359352
*
360353
* @return void
361354
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
362355
*/
363-
public function testExecuteAddSuccessException()
356+
public function testExecuteAddSuccessException(): void
364357
{
365358
$wishlist = $this->createMock(Wishlist::class);
366359
$product = $this->createMock(Product::class);
@@ -401,15 +394,9 @@ public function testExecuteAddSuccessException()
401394
->willReturn('Test name');
402395

403396
$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))
410397
->method('getParam')
411-
->with('id', null)
412-
->willReturn(3);
398+
->withConsecutive(['product', null], ['id', null])
399+
->willReturnOnConsecutiveCalls(2, 3);
413400

414401
$this->productRepository
415402
->expects($this->once())
@@ -476,12 +463,12 @@ public function testExecuteAddSuccessException()
476463
}
477464

478465
/**
479-
* Test execute add success critical exception
466+
* Test execute add success critical exception.
480467
*
481468
* @return void
482469
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
483470
*/
484-
public function testExecuteAddSuccessCriticalException()
471+
public function testExecuteAddSuccessCriticalException(): void
485472
{
486473
$wishlist = $this->createMock(Wishlist::class);
487474
$product = $this->createMock(Product::class);
@@ -493,8 +480,7 @@ public function testExecuteAddSuccessCriticalException()
493480
$logger
494481
->expects($this->once())
495482
->method('critical')
496-
->with($exception)
497-
->willReturn(true);
483+
->with($exception);
498484

499485
$helper
500486
->expects($this->exactly(2))
@@ -530,15 +516,9 @@ public function testExecuteAddSuccessCriticalException()
530516
->willReturn('Test name');
531517

532518
$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))
539519
->method('getParam')
540-
->with('id', null)
541-
->willReturn(3);
520+
->withConsecutive(['product', null], ['id', null])
521+
->willReturnOnConsecutiveCalls(2, 3);
542522

543523
$this->productRepository
544524
->expects($this->once())
@@ -575,20 +555,9 @@ public function testExecuteAddSuccessCriticalException()
575555
->willReturn([]);
576556

577557
$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))
589558
->method('get')
590-
->with(LoggerInterface::class)
591-
->willReturn($logger);
559+
->withConsecutive([Data::class], [Data::class], [LoggerInterface::class])
560+
->willReturnOnConsecutiveCalls($helper, $helper, $logger);
592561

593562
$this->eventManager
594563
->expects($this->once())

0 commit comments

Comments
 (0)