File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
app/code/Magento/Catalog/Test/Unit/Model Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -488,13 +488,13 @@ public function testGetByIdWhenCacheReduced()
488
488
$ expectedResult = [];
489
489
$ productsCount = $ this ->cacheLimit * 2 ;
490
490
491
- $ productMocks = $ this ->getProductMocksForReducedCache ();
491
+ $ productMocks = $ this ->getProductMocksForReducedCache ($ productsCount );
492
492
$ productFactoryInvMock = $ this ->productFactoryMock ->expects ($ this ->exactly ($ productsCount ))
493
493
->method ('create ' );
494
494
call_user_func_array ([$ productFactoryInvMock , 'willReturnOnConsecutiveCalls ' ], $ productMocks );
495
495
$ this ->serializerMock ->expects ($ this ->atLeastOnce ())->method ('serialize ' );
496
496
497
- for ($ i = 1 ; $ i <= $ productsCount ; $ i ++) {
497
+ for ($ i = 1 ; $ i <= $ productsCount ; $ i ++) {
498
498
$ product = $ this ->model ->getById ($ i , false , 0 );
499
499
$ result [] = $ product ->getId ();
500
500
$ expectedResult [] = $ i ;
@@ -506,13 +506,14 @@ public function testGetByIdWhenCacheReduced()
506
506
/**
507
507
* Get product mocks for testGetByIdWhenCacheReduced() method.
508
508
*
509
+ * @param int $productsCount
509
510
* @return array
510
511
*/
511
- private function getProductMocksForReducedCache ()
512
+ private function getProductMocksForReducedCache ($ productsCount )
512
513
{
513
514
$ productMocks = [];
514
515
515
- for ($ i = 1 ; $ i <= $ this -> cacheLimit * 2 ; $ i ++) {
516
+ for ($ i = 1 ; $ i <= $ productsCount ; $ i ++) {
516
517
$ productMock = $ this ->getMockBuilder (\Magento \Catalog \Model \Product::class)
517
518
->disableOriginalConstructor ()
518
519
->setMethods ([
You can’t perform that action at this time.
0 commit comments