@@ -383,15 +383,20 @@ public function testIndexerAfterDeleteCommitProduct()
383
383
public function testReindex ($ productChanged , $ isScheduled , $ productFlatCount , $ categoryIndexerCount )
384
384
{
385
385
$ this ->model ->setData ('entity_id ' , 1 );
386
- $ this ->_catalogProduct ->expects ($ this ->once ())->method ('isDataForProductCategoryIndexerWasChanged ' )->willReturn ($ productChanged );
386
+ $ this ->_catalogProduct ->expects ($ this ->once ())
387
+ ->method ('isDataForProductCategoryIndexerWasChanged ' )
388
+ ->willReturn ($ productChanged );
389
+ if ($ productChanged ) {
390
+ $ this ->indexerRegistryMock ->expects ($ this ->exactly ($ productFlatCount ))
391
+ ->method ('get ' )
392
+ ->with (\Magento \Catalog \Model \Indexer \Product \Category::INDEXER_ID )
393
+ ->will ($ this ->returnValue ($ this ->categoryIndexerMock ));
394
+ $ this ->categoryIndexerMock ->expects ($ this ->any ())
395
+ ->method ('isScheduled ' )
396
+ ->will ($ this ->returnValue ($ isScheduled ));
397
+ $ this ->categoryIndexerMock ->expects ($ this ->exactly ($ categoryIndexerCount ))->method ('reindexRow ' );
398
+ }
387
399
$ this ->productFlatProcessor ->expects ($ this ->exactly ($ productFlatCount ))->method ('reindexRow ' );
388
- $ this ->indexerRegistryMock ->expects ($ this ->exactly ($ productFlatCount ))
389
- ->method ('get ' )
390
- ->with (\Magento \Catalog \Model \Indexer \Product \Category::INDEXER_ID )
391
- ->will ($ this ->returnValue ($ this ->categoryIndexerMock ));
392
- $ this ->categoryIndexerMock ->expects ($ this ->any ())->method ('isScheduled ' )->will ($ this ->returnValue ($ isScheduled ));
393
- $ this ->categoryIndexerMock ->expects ($ this ->exactly ($ categoryIndexerCount ))->method ('reindexRow ' );
394
-
395
400
$ this ->model ->reindex ();
396
401
}
397
402
@@ -400,7 +405,7 @@ public function getProductReindexProvider()
400
405
return array (
401
406
'set 1 ' => [true , false , 1 , 1 ],
402
407
'set 2 ' => [true , true , 1 , 0 ],
403
- 'set 3 ' => [false , false , 0 , 0 ]
408
+ 'set 3 ' => [false , false , 1 , 0 ]
404
409
);
405
410
}
406
411
@@ -465,6 +470,21 @@ public function getIdentitiesProvider()
465
470
'affected_category_ids ' => [1 ],
466
471
'is_changed_categories ' => true
467
472
]
473
+ ],
474
+ [
475
+ [0 => 'catalog_product_1 ' , 1 => 'catalog_category_product_1 ' ],
476
+ ['id ' => 1 , 'name ' => 'value ' , 'category_ids ' => [1 ], 'status ' => 2 ],
477
+ ['id ' => 1 , 'name ' => 'value ' , 'category_ids ' => [1 ], 'status ' => 1 ],
478
+ ],
479
+ [
480
+ [0 => 'catalog_product_1 ' ],
481
+ ['id ' => 1 , 'name ' => 'value ' , 'category_ids ' => [1 ], 'status ' => 1 ],
482
+ ['id ' => 1 , 'name ' => 'value ' , 'category_ids ' => [1 ], 'status ' => 2 ],
483
+ ],
484
+ [
485
+ [0 => 'catalog_product_1 ' ],
486
+ ['id ' => 1 , 'name ' => 'value ' , 'category_ids ' => [1 ], 'status ' => 2 ],
487
+ ['id ' => 1 , 'name ' => 'value ' , 'category_ids ' => [], 'status ' => 1 ],
468
488
]
469
489
];
470
490
}
0 commit comments