MobileDetectBundle
MobileDetectBundle copied to clipboard
How to "fake" mobile in tests?
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
:+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.
I think you can do that with the device_view
cookie https://github.com/suncat2000/MobileDetectBundle/blob/master/Helper/DeviceView.php#L36