MobileDetectBundle icon indicating copy to clipboard operation
MobileDetectBundle copied to clipboard

How to "fake" mobile in tests?

Open garak opened this issue 8 years ago • 2 comments

I need to test a portion of code where isMobile() method is used, so I need to get two different cases, true and false. How can I do it? TIA

garak avatar Sep 04 '15 08:09 garak

:+1:

I also would like to get some intel.

My idea: either in config or query param (not device_view) set the desired view (not device type, view). Catch it in a listener, and set the view in the DeviceView service. The use the device view service or twig functions.

sagikazarmark avatar Dec 09 '15 21:12 sagikazarmark

I think you can do that with the device_view cookie https://github.com/suncat2000/MobileDetectBundle/blob/master/Helper/DeviceView.php#L36

adrienbrault avatar Sep 02 '16 15:09 adrienbrault