@@ -195,4 +195,63 @@ public function testBatchProcessing()
195195
196196 $ this ->actionRows ->execute ($ ids );
197197 }
198+
199+ public function testDeletedProductsBatchProcessing ()
200+ {
201+ $ ids = [1 , 2 , 3 , 4 ];
202+
203+ $ select = $ this ->createMock (Select::class);
204+ $ select ->method ('from ' )->willReturnSelf ();
205+ $ select ->method ('joinLeft ' )->willReturnSelf ();
206+ $ select ->method ('where ' )->willReturnSelf ();
207+ $ select ->method ('join ' )->willReturnSelf ();
208+ $ adapter = $ this ->createMock (AdapterInterface::class);
209+ $ adapter ->method ('select ' )->willReturn ($ select );
210+ $ adapter ->method ('describeTable ' )->willReturn ([]);
211+ $ this ->defaultIndexerResource ->method ('getConnection ' )->willReturn ($ adapter );
212+ $ adapter ->method ('fetchAll ' )->with ($ select )->willReturn ([]);
213+
214+ $ adapter ->expects ($ this ->exactly (4 ))
215+ ->method ('fetchPairs ' )
216+ ->with ($ select )
217+ ->willReturnOnConsecutiveCalls ([], [], [], []);
218+ $ multiDimensionProvider = $ this ->createMock (MultiDimensionProvider::class);
219+ $ this ->dimensionCollectionFactory ->expects ($ this ->exactly (2 ))
220+ ->method ('create ' )
221+ ->willReturn ($ multiDimensionProvider );
222+ $ dimension = $ this ->createMock (Dimension::class);
223+ $ dimension ->method ('getName ' )->willReturn ('default ' );
224+ $ dimension ->method ('getValue ' )->willReturn ('0 ' );
225+ $ iterator = new \ArrayIterator ([[$ dimension ]]);
226+ $ multiDimensionProvider ->expects ($ this ->exactly (2 ))
227+ ->method ('getIterator ' )
228+ ->willReturn ($ iterator );
229+ $ this ->catalogProductType ->expects ($ this ->once ())
230+ ->method ('getTypesByPriority ' )
231+ ->willReturn (
232+ [
233+ 'virtual ' => ['price_indexer ' => '\Price\Indexer ' ],
234+ 'simple ' => ['price_indexer ' => '\Price\Indexer ' ],
235+ ]
236+ );
237+ $ priceIndexer = $ this ->createMock (DimensionalIndexerInterface::class);
238+ $ this ->indexerPriceFactory ->expects ($ this ->exactly (2 ))
239+ ->method ('create ' )
240+ ->with ('\Price\Indexer ' , ['fullReindexAction ' => false ])
241+ ->willReturn ($ priceIndexer );
242+ $ priceIndexer ->expects ($ this ->never ())
243+ ->method ('executeByDimensions ' );
244+ $ select ->expects ($ this ->exactly (2 ))
245+ ->method ('deleteFromSelect ' )
246+ ->with ('index_price ' )
247+ ->willReturn ('' );
248+ $ adapter ->expects ($ this ->exactly (2 ))
249+ ->method ('getIndexList ' )
250+ ->willReturn (['entity_id ' =>['COLUMNS_LIST ' =>['test ' ]]]);
251+ $ adapter ->expects ($ this ->exactly (2 ))
252+ ->method ('getPrimaryKeyName ' )
253+ ->willReturn ('entity_id ' );
254+
255+ $ this ->actionRows ->execute ($ ids );
256+ }
198257}
0 commit comments