@@ -204,9 +204,6 @@ public function testExecute($indexerIds, $exception)
204
204
->method ('addError ' )->with (__ ('Please select indexers. ' ))
205
205
->will ($ this ->returnValue (1 ));
206
206
} else {
207
- $ this ->objectManager ->expects ($ this ->any ())
208
- ->method ('get ' )->with (\Magento \Framework \Indexer \IndexerRegistry::class)
209
- ->will ($ this ->returnValue ($ this ->indexReg ));
210
207
$ indexerInterface = $ this ->getMockForAbstractClass (
211
208
\Magento \Framework \Indexer \IndexerInterface::class,
212
209
['invalidate ' ],
@@ -226,12 +223,16 @@ public function testExecute($indexerIds, $exception)
226
223
->will ($ this ->returnValue (1 ));
227
224
228
225
if ($ exception ) {
226
+ $ this ->indexReg ->expects ($ this ->any ())
227
+ ->method ('get ' )->with (2 )
228
+ ->will ($ this ->throwException ($ exception ));
229
+
229
230
if ($ exception instanceof \Magento \Framework \Exception \LocalizedException) {
230
- $ this ->messageManager ->expects ($ this ->exactly ( 1 ))
231
+ $ this ->messageManager ->expects ($ this ->once ( ))
231
232
->method ('addError ' )
232
233
->with ($ exception ->getMessage ());
233
234
} else {
234
- $ this ->messageManager ->expects ($ this ->exactly ( 1 ))
235
+ $ this ->messageManager ->expects ($ this ->once ( ))
235
236
->method ('addException ' )
236
237
->with ($ exception , "We couldn't invalidate indexer(s) because of an error. " );
237
238
}
@@ -260,11 +261,11 @@ public function executeDataProvider()
260
261
'exception ' => null ,
261
262
],
262
263
'set3 ' => [
263
- 'indexers ' => [1 ],
264
+ 'indexers ' => [2 ],
264
265
'exception ' => new \Magento \Framework \Exception \LocalizedException (__ ('Test Phrase ' )),
265
266
],
266
267
'set4 ' => [
267
- 'indexers ' => [1 ],
268
+ 'indexers ' => [2 ],
268
269
'exception ' => new \Exception (),
269
270
]
270
271
];
0 commit comments