@@ -380,21 +380,37 @@ public function testReindexFlatEnabled($flatScheduled, $productScheduled, $expec
380
380
public function reindexFlatDisabledTestDataProvider ()
381
381
{
382
382
return [
383
- 'set 1 ' => [false , 1 ],
384
- 'set 2 ' => [true , 0 ],
383
+ [false , null , null , null , 0 ],
384
+ [true , null , null , null , 0 ],
385
+ [false , [], null , null , 0 ],
386
+ [false , ["1 " , "2 " ], null , null , 1 ],
387
+ [false , null , 1 , null , 1 ],
388
+ [false , ["1 " , "2 " ], 0 , 1 , 1 ],
389
+ [false , null , 1 , 1 , 0 ],
385
390
];
386
391
}
387
392
388
393
/**
389
- * @param $productScheduled
390
- * @param $expectedProductReindexCall
394
+ * @param bool $productScheduled
395
+ * @param array $affectedIds
396
+ * @param int|string $isAnchorOrig
397
+ * @param int|string $isAnchor
398
+ * @param int $expectedProductReindexCall
391
399
*
392
400
* @dataProvider reindexFlatDisabledTestDataProvider
393
401
*/
394
- public function testReindexFlatDisabled ($ productScheduled , $ expectedProductReindexCall )
395
- {
396
- $ affectedProductIds = ["1 " , "2 " ];
397
- $ this ->category ->setAffectedProductIds ($ affectedProductIds );
402
+ public function testReindexFlatDisabled (
403
+ $ productScheduled ,
404
+ $ affectedIds ,
405
+ $ isAnchorOrig ,
406
+ $ isAnchor ,
407
+ $ expectedProductReindexCall
408
+ ) {
409
+ $ this ->category ->setAffectedProductIds ($ affectedIds );
410
+ $ this ->category ->setData ('is_anchor ' , $ isAnchor );
411
+ $ this ->category ->setOrigData ('is_anchor ' , $ isAnchorOrig );
412
+ $ this ->category ->setAffectedProductIds ($ affectedIds );
413
+
398
414
$ pathIds = ['path/1/2 ' , 'path/2/3 ' ];
399
415
$ this ->category ->setData ('path_ids ' , $ pathIds );
400
416
$ this ->category ->setId ('123 ' );
@@ -403,8 +419,12 @@ public function testReindexFlatDisabled($productScheduled, $expectedProductReind
403
419
->method ('isFlatEnabled ' )
404
420
->will ($ this ->returnValue (false ));
405
421
406
- $ this ->productIndexer ->expects ($ this ->exactly (1 ))->method ('isScheduled ' )->will ($ this ->returnValue ($ productScheduled ));
407
- $ this ->productIndexer ->expects ($ this ->exactly ($ expectedProductReindexCall ))->method ('reindexList ' )->with ($ pathIds );
422
+ $ this ->productIndexer ->expects ($ this ->exactly (1 ))
423
+ ->method ('isScheduled ' )
424
+ ->willReturn ($ productScheduled );
425
+ $ this ->productIndexer ->expects ($ this ->exactly ($ expectedProductReindexCall ))
426
+ ->method ('reindexList ' )
427
+ ->with ($ pathIds );
408
428
409
429
$ this ->indexerRegistry ->expects ($ this ->at (0 ))
410
430
->method ('get ' )
0 commit comments