@@ -260,6 +260,7 @@ public function testNoRewriteAfterStoreSwitcherWhenOldRewriteEqualsToNewOne()
260
260
*/
261
261
public function testMatchWithRedirect ()
262
262
{
263
+ $ queryParams = [];
263
264
$ this ->storeManager ->expects ($ this ->any ())->method ('getStore ' )->will ($ this ->returnValue ($ this ->store ));
264
265
$ urlRewrite = $ this ->getMockBuilder (UrlRewrite::class)
265
266
->disableOriginalConstructor ()->getMock ();
@@ -268,7 +269,11 @@ public function testMatchWithRedirect()
268
269
$ this ->urlFinder ->expects ($ this ->any ())->method ('findOneByData ' )->will ($ this ->returnValue ($ urlRewrite ));
269
270
$ this ->response ->expects ($ this ->once ())->method ('setRedirect ' )
270
271
->with ('new-target-path ' , 'redirect-code ' );
271
- $ this ->url ->expects ($ this ->once ())->method ('getUrl ' )->with ('' , ['_direct ' => 'target-path ' ])
272
+ $ this ->request ->expects ($ this ->once ())->method ('getParams ' )->willReturn ($ queryParams );
273
+ $ this ->url ->expects ($ this ->once ())->method ('getUrl ' )->with (
274
+ '' ,
275
+ ['_direct ' => 'target-path ' , '_query ' => $ queryParams ]
276
+ )
272
277
->will ($ this ->returnValue ('new-target-path ' ));
273
278
$ this ->request ->expects ($ this ->once ())->method ('setDispatched ' )->with (true );
274
279
$ this ->actionFactory ->expects ($ this ->once ())->method ('create ' )
@@ -282,15 +287,20 @@ public function testMatchWithRedirect()
282
287
*/
283
288
public function testMatchWithCustomInternalRedirect ()
284
289
{
290
+ $ queryParams = [];
285
291
$ this ->storeManager ->expects ($ this ->any ())->method ('getStore ' )->will ($ this ->returnValue ($ this ->store ));
286
292
$ urlRewrite = $ this ->getMockBuilder (UrlRewrite::class)
287
293
->disableOriginalConstructor ()->getMock ();
288
294
$ urlRewrite ->expects ($ this ->any ())->method ('getEntityType ' )->will ($ this ->returnValue ('custom ' ));
289
295
$ urlRewrite ->expects ($ this ->any ())->method ('getRedirectType ' )->will ($ this ->returnValue ('redirect-code ' ));
290
296
$ urlRewrite ->expects ($ this ->any ())->method ('getTargetPath ' )->will ($ this ->returnValue ('target-path ' ));
291
297
$ this ->urlFinder ->expects ($ this ->any ())->method ('findOneByData ' )->will ($ this ->returnValue ($ urlRewrite ));
298
+ $ this ->request ->expects ($ this ->any ())->method ('getParams ' )->willReturn ($ queryParams );
292
299
$ this ->response ->expects ($ this ->once ())->method ('setRedirect ' )->with ('a ' , 'redirect-code ' );
293
- $ this ->url ->expects ($ this ->once ())->method ('getUrl ' )->with ('' , ['_direct ' => 'target-path ' ])->willReturn ('a ' );
300
+ $ this ->url ->expects ($ this ->once ())->method ('getUrl ' )->with (
301
+ '' ,
302
+ ['_direct ' => 'target-path ' , '_query ' => $ queryParams ]
303
+ )->willReturn ('a ' );
294
304
$ this ->request ->expects ($ this ->once ())->method ('setDispatched ' )->with (true );
295
305
$ this ->actionFactory ->expects ($ this ->once ())->method ('create ' )
296
306
->with (\Magento \Framework \App \Action \Redirect::class);
@@ -312,6 +322,7 @@ public function testMatchWithCustomExternalRedirect($targetPath)
312
322
$ urlRewrite ->expects ($ this ->any ())->method ('getTargetPath ' )->will ($ this ->returnValue ($ targetPath ));
313
323
$ this ->urlFinder ->expects ($ this ->any ())->method ('findOneByData ' )->will ($ this ->returnValue ($ urlRewrite ));
314
324
$ this ->response ->expects ($ this ->once ())->method ('setRedirect ' )->with ($ targetPath , 'redirect-code ' );
325
+ $ this ->request ->expects ($ this ->never ())->method ('getParams ' );
315
326
$ this ->url ->expects ($ this ->never ())->method ('getUrl ' );
316
327
$ this ->request ->expects ($ this ->once ())->method ('setDispatched ' )->with (true );
317
328
$ this ->actionFactory ->expects ($ this ->once ())->method ('create ' )
0 commit comments